在存储过程中,使用表名做参数时怎样做查询?
clbug 2003-06-17 03:02:10 存储过程表名参数为@dbname,关键字@title;
怎么判断表@dbname中是否存在字段title=@title的记录?
如果直接用
Select * from @dbname where title=@title
会报错;如果用
exec('Select * from '+@dbname+' where title='''+@title+
'''')
好像不能用if exists exec('..')来判断执行结果?
各位老大,应该怎么做啊?