RE: Inserting a record count using Dynamic SQL
alternative method for placing the record count from a table into a variableDECLARE @sql nvarchar(100),@Reccount int SET @sql = 'SELECT COUNT(*) FROM InterchangeDTA.dbo.' + @TableName EXECUTE sp_executesql @sql, N'@Reccount int output', @Reccount output Then you can insertINSERT INTO TableCounter (TableName) VALUES @Reccount btw, you state TableName as the column for insert but use the count […]
2004-05-25