Tuesday, July 5, 2011

Inline Functions : What is wrong with the following code ?

What is wrong with the following code :


create function test
 ( @inp int)
returns int as
return ( @inp)

[http://msdn.microsoft.com/en-us/library/aa214762(v=sql.80).aspx
Inline user-defined functions are a subset of user-defined functions that return a table]

 

Inline functions cannot return any other data type than table.

http://msdn.microsoft.com/en-us/library/ms189294.aspx

Inline User-defined Function Rules



  • The RETURNS clause contains only the keyword table. You do not have to define the format of a return variable, because it is set by the format of the result set of the SELECT statement in the RETURN clause.



  • There is no function_body delimited by BEGIN and END.



  • The RETURN clause contains a single SELECT statement in parentheses. The result set of the SELECT statement forms the table returned by the function. The SELECT statement used in an inline function is subject to the same restrictions as SELECT statements used in views.



  • The table-valued function accepts only constants or @local_variable arguments






  • Inline user-defined functions are a subset of user-defined functions that return a table. Inline functions can be used to achieve the functionality of parameterized views.

    No comments:

    Post a Comment

    How to check local and global angular versions

     Use the command ng version (or ng v ) to find the version of Angular CLI in the current folder. Run it outside of the Angular project, to f...