DECLARE @sql NVARCHAR(100)
SET @sql = 'select * from tablename'
EXEC sp_executesql @sql
EXEC也可以完成同样效果
EXEC( ' select * from tablename')
DECLARE @sql NVARCHAR(100)
SET @sql = 'select * from tablename'
EXEC sp_executesql @sql
EXEC也可以完成同样效果
EXEC( ' select * from tablename')