![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
I am writing a function which will take two parameters. One the field to be returned from a table and second parameter is the ID of the record to be returned. Problem is it's not returning the value of the field specified in the parameter but instead returns the parameter itself. Is there a function that will get the parameter to be evaluted first? ALTER FUNCTION [dbo].[getScholarYearData] ( -- Add the parameters for the function here @FieldName varchar(50), @ScholarID int ) RETURNS varchar(255) AS BEGIN -- Declare the return variable here DECLARE @ResultVar varchar(255) -- Add the T-SQL statements to compute the return value here SELECT @ResultVar=EXECUTE(@FieldName) |
#4
| |||
| |||
|
|
I am writing a function which will take two parameters. One the field [sic] to be returned from a table and second parameter is the ID of the record [sic] to be returned. |
#5
| |||
| |||
|
|
Also, never put the data type in a data element name like Paul did; This is SQL and not 1960's BASIC for a 16KB PC. Please can you explain what you mean by this? This procedure works |
#6
| |||
| |||
|
|
Also, never put the data type in a data element name like Paul did; This is SQL and not 1960's BASIC for a 16KB PC. Please can you explain what you mean by this? This procedure works fine for me, but If there is a better way of doing something then I would like to know what it is. I am not sure we actually need to have a procedure like this in our system, but this is how I would have written it if so. Any improvements would be appreciated! |
#7
| |||
| |||
|
|
I love the stuff about my table structure being poorly designed. They know this without even seeing it. |
#8
| |||
| |||
|
|
SQL Server wrote: I love the stuff about my table structure being poorly designed. They know this without even seeing it. It is not necessary to see your DDL to know much about the design. Joe and Erland tried to do you a favor. Others like me just shook their heads and just let it going knowing there are so many people out there that think because they can write some syntactically correct code they are developers. You owe several people apologies. -- Daniel A. Morgan University of Washington damor...@x.washington.edu (replace x with u to respond) |
#9
| |||
| |||
|
|
Please can you explain what you mean by this? |
#10
| |||
| |||
|
|
If you wish, I can also post a quick look at ISO-11179. |
![]() |
| Thread Tools | |
| Display Modes | |
| |