User Defined Function Error when using varchar

User Defined Function Error when using varchar

Post by Marita Empera » Sat, 01 Feb 2003 08:26:19



This is my code
CREATE FUNCTION  dbo.fun_returnscheduletext
Returns(varchar(2046))
As
BEGIN





















+ 'Z' + '
FREQ=DAILY'


end

and i get a SQLServer error stating this: Server: Msg 170, Level 15,
State 1, Procedure fun_returnscheduletext, Line 3
Line 3: Incorrect syntax near 'Returns'.
Server: Msg 178, Level 15, State 1, Procedure fun_returnscheduletext,
Line 38
A RETURN statement with a return value cannot be used in this context.
Anyone know why this is happening?

 
 
 

User Defined Function Error when using varchar

Post by Aaron Bertrand [MVP » Sat, 01 Feb 2003 08:32:44



...


Well, since datepart returns an INTEGER, not an NVARCHAR, this line is just
the start of your problems...

--
Aaron Bertrand, SQL Server MVP
http://www.aspfaq.com/

Please reply in the newsgroups, but if you absolutely
must reply via e-mail, please take out the TRASH.