Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Function Help

Author  Topic 

rcr69er
Constraint Violating Yak Guru

327 Posts

Posted - 2008-10-08 : 10:19:54
Hi Guys

I've created the following function but I'm not sure how to sort out the incorrect syntax. It states its near the TOP function.

CREATE FUNCTION udf_SetPrimaryAccountID
(@inValue varchar(50))

RETURNS varchar(50)
AS
BEGIN

DECLARE @outValue varchar(50)
SET @outValue =
TOP 1 [Account Number]
FROM [TMP.Supplier2]
WHERE [Full Name] = @inValue
ORDER BY [Account Number]

RETURN @outValue
END

Any Ideas?

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-08 : 10:21:56
quote:
Originally posted by rcr69er

Hi Guys

I've created the following function but I'm not sure how to sort out the incorrect syntax. It states its near the TOP function.

CREATE FUNCTION udf_SetPrimaryAccountID
(@inValue varchar(50))

RETURNS varchar(50)
AS
BEGIN

DECLARE @outValue varchar(50)
SELECT TOP 1 @outValue =
TOP 1 [Account Number]
FROM [TMP.Supplier2]
WHERE [Full Name] = @inValue
ORDER BY [Account Number]

RETURN @outValue
END

Any Ideas?

Thanks



modify as above
Go to Top of Page

rcr69er
Constraint Violating Yak Guru

327 Posts

Posted - 2008-10-08 : 10:38:48
Thanks yet again!!!
:D
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-08 : 10:41:12
quote:
Originally posted by rcr69er

Thanks yet again!!!
:D


welcome
Go to Top of Page
   

- Advertisement -