Home Forums SQL Server 7,2000 T-SQL return value from exec(string) RE: return value from exec(string)
GRN
Hall of Fame
Points: 3260
More actions
May 23, 2003 at 12:10 am
#458298
This one does not need a temp table
USE PUBS
DECLARE @STRnvarchar(200),
@Parm nvarchar(20),
@Cntint
SET @STR = 'SELECT @Cnt= COUNT(*) FROM Authors'
SET @Parm = '@Cnt int output'
EXEC sp_executesql @STR , @Parm ,@Cnt OUT
PRINT @Cnt