关于存储过程,传入的参数用作表名,怎么处理

参数是表名,在过程中怎么select这个变量啊?急
---------------------------------------------------------------

create proc tablea (@tablename nvarchar(20))
as
declare @str char(50)
set @str='select * from '+@tablename+''
exec(@str)
go

Published At
Categories with Web编程
Tagged with
comments powered by Disqus