select * from (@test2) 提示必须声明变量 '@test2',请问应该怎么写
declare @test2 varchar(100)
set @test2='select getdate() where 1 =1'
select * from (@test2)
------解决方案--------------------declare @test2 varchar(100)
set @test2='select getdate() from tablename where 1 =1'
exec(@test2)