Translate

Thursday, September 12, 2013

Dynamic sql output variable

DECLARE @ParmDefinition NVARCHAR(500) 
DECLARE @count INT 

SET @ParmDefinition='@count int output' 

EXECUTE sp_executesql 
  N'select @count=count(*) from persons', 
  @ParmDefinition, 
  @count=@count output 

SELECT @count 

No comments:

Post a Comment

Comments will appear once they have been approved by the moderator