Thursday, January 3, 2013

Pass Parameters to a Sql Server Function


Create a function which accepts one parameter and returns a table.

CREATE FUNCTION GetID(@num INT)
RETURNS TABLE
AS RETURN
(
SELECT @num+1 AS 'NUMBER'
)

Retrieve the function output using below query.

select * from
GetID(2)

Output:
Number
3

No comments:
Write comments
Recommended Posts × +