DECLARE @Str nVARCHAR(4000)
SET @Str='select * from o_1023'
exec (@Str)
有时候sql并不是写死的,需要根据情况传入一些条件,或者值。
可以用exec (@变量名)去执行。