Declare @sql nvarchar(max),
@sql_id INT
SELECT @sql=N'SELECT TOP 1 @sql_id =colName FROM Table1'
EXEC sp_executesql @sql, N'@sql_id INT output', @sql_id output
SELECT @sql_id
@sql_id INT
SELECT @sql=N'SELECT TOP 1 @sql_id =colName FROM Table1'
EXEC sp_executesql @sql, N'@sql_id INT output', @sql_id output
SELECT @sql_id
No comments:
Post a Comment