表不能用变量的。可以执行字符串啊, Exec('select * from A') 执行字符串的功能很大的哦
xfei,不懂你的意思 能说明白点吗? 我是在存储过程里操作啊,
xfei,你好 EXEC返回什么值??? 怎么取执行过后,得到的数据集??
用@@rowcount判断:declare @sqlstr varchar(200) select @sqlstr='select * from '+@tablename+' where yf='+@yf+' and nf='+@nf exec(@sqlstr) if @@rowcount=0 begin select @out=1 end
Exec('select * from A')
执行字符串的功能很大的哦
能说明白点吗?
我是在存储过程里操作啊,
EXEC返回什么值???
怎么取执行过后,得到的数据集??
select @sqlstr='select * from '+@tablename+' where yf='+@yf+' and nf='+@nf
exec(@sqlstr)
if @@rowcount=0
begin
select @out=1
end