Home > Uncategorized > RETURN statements in scalar valued functions must include an argument.

RETURN statements in scalar valued functions must include an argument.

Ever get one of those vague error messages back from SQL server, for once, I decided to throw a bit of light on this gem "RETURN statements in scalar valued functions must include an argument."
 
It occurs when you omit the brackets after a return statement in a User defined function i.e
 
create function fn_something(@something float)
returns float
as
begin
 return
 select  @something + 10  
end
 
gives you:
Server: Msg 1075, Level 15, State 1, Procedure fn_something, Line 5
RETURN statements in scalar valued functions must include an argument.
 
but this works
 
create function fn_something(@something float)
returns float
as
begin
 return ( select  @something + 10  )
end
Advertisements
Categories: Uncategorized
  1. marisha
    May 22, 2012 at 5:12 pm

    Thank you I used your link to solve the same problem I was getting

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: