johnkainn
asked on
function if
In sql 2008 I call a function from stored procedure.
I would like to have an if statement in the function. Following returns error. How is best to do this?
ALTER FUNCTION [dbo].[myFunction](@GId int)
RETURNS TABLE
AS
RETURN(
if @GId >0
begin
--...select statement
end
else
begin
.....
end
)
I would like to have an if statement in the function. Following returns error. How is best to do this?
ALTER FUNCTION [dbo].[myFunction](@GId int)
RETURNS TABLE
AS
RETURN(
if @GId >0
begin
--...select statement
end
else
begin
.....
end
)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER