Problem creating a function by code
Posted: Wed 07 Dec 2011 15:54
Hi, I am trying to create a function in the database by code.
For example..
create function dbo.myfunction(@i int)
returns int
as
begin
declare @r int
set @r = @i * 2
return @i
end
I get the message a RETURN statement with a return value cannot be used in this context. Must declare the scalar variable @id.
Incorrect syntax near the keyword 'function'.
This works from management studio but fails from tmsscript, tmsconnection
For example..
create function dbo.myfunction(@i int)
returns int
as
begin
declare @r int
set @r = @i * 2
return @i
end
I get the message a RETURN statement with a return value cannot be used in this context. Must declare the scalar variable @id.
Incorrect syntax near the keyword 'function'.
This works from management studio but fails from tmsscript, tmsconnection