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.
| Author |
Topic |
|
rcr69er
Constraint Violating Yak Guru
327 Posts |
Posted - 2008-10-08 : 10:19:54
|
| Hi GuysI'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)ASBEGINDECLARE @outValue varchar(50)SET @outValue = TOP 1 [Account Number] FROM [TMP.Supplier2] WHERE [Full Name] = @inValue ORDER BY [Account Number]RETURN @outValueENDAny Ideas?Thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-08 : 10:21:56
|
quote: Originally posted by rcr69er Hi GuysI'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)ASBEGINDECLARE @outValue varchar(50)SELECT TOP 1 @outValue = TOP 1 [Account Number] FROM [TMP.Supplier2] WHERE [Full Name] = @inValue ORDER BY [Account Number]RETURN @outValueENDAny Ideas?Thanks
modify as above |
 |
|
|
rcr69er
Constraint Violating Yak Guru
327 Posts |
Posted - 2008-10-08 : 10:38:48
|
| Thanks yet again!!!:D |
 |
|
|
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 |
 |
|
|
|
|
|