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

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -