CREATE FUNCTION dbo.GetInfo(@CustomerID int)returns @userTable table -- Defines format of the table to be returned.(ID int not null,name nvarchar(20) not null)ASBEGINDECLARE@ID int,@CName nvarchar(20)SELECT @ID= id, @CName = name from myTable where id=@CustomerID;INSERT @userTable SELECT @ID, @CName;RETURN;-- It cannot have any arguments. Once it is called, returns all rows in table variableEND;--Procedure to call itGOSELECT ID,name from dbo.GetInfo(100);GO
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: