EXEC输出调用外部变量要怎么办呢?
--例子declare @a nvarchar(100),@b int;set @b=20;set @a='@b-2';exec(@a)/*这样的输出提示没有申明变量Msg 137, Level 15, State 2, Line 1Must declare the scalar variable "@b".这样怎么把字符串里面的变量@b调用外部的值呢?*/
declare @a int,@b int, @GSResule nvarchare(1000)set @a=3,set @b=4,select @GSResule='select gs from test where gs > @a and gs< @b' exec sp_executesql @GSResule, N'@a int,@b int',@a,@b