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
 General SQL Server Forums
 New to SQL Server Programming
 function

Author  Topic 

sushma patle
Starting Member

15 Posts

Posted - 2008-05-24 : 07:58:36
what is the error near as
---->

create function listname()
AS
BEGIN

Declare @authorname varchar(1000)

SET @authorname= ''
SELECT @authorname = @authorname + AuthorName + ',' FROM Author

END

can we cant create a function which don't return any value.

spatle

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-05-24 : 08:41:53
>>can we cant create a function which don't return any value.
what purpose would a function serve that doesn't return anything?

As you probably guessed the error is that you don't have a RETURNS clause nor a RETURN statement.

EDIT:

create function dbo.listname()
returns varchar(1000)
AS
BEGIN

Declare @authorname varchar(1000)

SELECT @authorname = coalesce(@authorname + ',' + AuthorName, AuthorName)
FROM Author

return @authorname
END
go




Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -