Reply to Function Parameter

Your name:

Reply:


Posted by SQL Server on 04/19/07 21:42

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)
FROM dbo.qmaxScholarYearID INNER JOIN
dbo.tblScholarYears ON
dbo.qmaxScholarYearID.ScholarID = dbo.tblScholarYears.ScholarID AND
dbo.qmaxScholarYearID.MaxOfScholarYearID =
dbo.tblScholarYears.ScholarYearID

-- Return the result of the function
RETURN @ResultVar

END

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация