sql server - Stored procedure -


how type of return value in stored procedure. , difference between them. please explain me.

typically stored procedures expect dataset. if looking way single values type of query, might better suited making udf (user defined function).

nonetheless, here how can create stored procedure output variable

create procedure dbo.getnamebyid (     @id nvarchar(50),     @personname nvarchar(50) output ) select @personname = lastname person.contact id = @id 

with procedure, can execute follows.

declare @name nvarchar(50)  exec dbo.getnamebyid      @id = 'a123fb',     @personname = @name output  select name = @name 

good luck.


Comments

Popular posts from this blog

razor - Is this a bug in WebMatrix PageData? -

iphone - Requiring the presence of a method in an id -

xslt - Is it possible to select a node that just includes a subset of the child nodes? -