create procedure showMe @Tname varchar(30)
AS
BEGIN
select * from @Tname -->>am i violate some rules !!
END ;
------------------------------------------
@JNevill我想我得到了你的想法,但不是很正确。
create procedure showMe @Tname varchar(30)
AS
BEGIN
declare @SS varchar(40) = 'Select * from '
declare @CC varchar(80)
@CC = @SS + @Tname
sp_executesql @CC
END ;
我找到了解决方案.......
create procedure showMe @Tname varchar(30)
AS
BEGIN
EXEC('select * from ' + @Tname)
END ;