日期:2014-05-18  浏览次数:20378 次

大家帮我看看我怎么错了
ALTER proc [dbo].[pr_test]
(
@arg varchar(20)
)
as
declare @str varchar(100)
set @str='select * from t1 where arg='''+@arg+''''
exec @str 
set @str='select * from t2 where arg='''+@arg+''''
exec @str



我这么写有什么错误啊

------解决方案--------------------
ALTER proc [dbo].[pr_test]
(
@arg varchar(20)
)
as
declare @str varchar(100)
set @str='select * from t1 where arg='''+@arg+''''
exec (@str)
set @str='select * from t2 where arg='''+@arg+''''
exec (@str)