Friday, September 9, 2011

Setting a variable from dynamic sql


declare @i int
exec sp_executesql N'select @i = 999', N'@i int output', @i output
select @i


-- setting output parameter from dynamic stored procedure call

declare @OutputParameter varchar(100) ,
@error int ,
@SPName varchar(128) ,
@SPCall nvarchar(128) ,
@rc int
select @SPCall = 'exec ' + @SPName + ' @OutputParameter output'
exec @rc = sp_executesql @SPCall, N'@OutputParameter varchar(100) output', @OutputParameter output
select @Error = @@error

If you are searching life partner. your searching end with kpmarriage.com. now kpmarriage.com offer free matrimonial website which offer free message, free chat, free view contact information. so register here : kpmarriage.com- Free matrimonial website

0 comments:

Post a Comment