Differences

This shows you the differences between two versions of the page.

sql-server:table_valued_functions [April 03, 2012 8:26 am]
sqlines
sql-server:table_valued_functions [April 03, 2012 8:34 am] (current)
sqlines
Line 8: Line 8:
   -- Create a table-valued user-defined function    -- Create a table-valued user-defined function
   CREATE FUNCTION get_cities (@filter VARCHAR(70))    CREATE FUNCTION get_cities (@filter VARCHAR(70))
-   RETURNS @cities TABLE   -- Define the return table+   RETURNS @cities TABLE   -- Table definition for result
   (    (
      name VARCHAR(90),       name VARCHAR(90),
Line 22: Line 22:
   END;    END;
   GO      GO  
 +  
 +   -- Call the function
 +   SELECT * FROM get_cities('%');
</code> </code>