日期:2014-05-18 浏览次数:20508 次
declare @A nvarchar(50) declare @B table(id int) insert into @B ([id]) values(1) set @A = 'select * from @B' exec sp_executesql @A
declare @A nvarchar(500) set @A = 'declare @B table(id int);insert into @B values(1);select * from @B;' exec sp_executesql @A -- 结果 id ----------- 1