将表名作为参数的问题
在下面的程序中,我想将table1,table2作为参数传进去,
也就是@tableName1,@tableName2,不知如何实现,请指点!
create procedure sp_Test
@tableName1 varchar(100),
@tableName2 varchar(100)
as
begin
if exists(select name from sysobjects where name='table1' and type='U')
drop table table1 --question1
declare cur_Test cursor for
select * from table2 --question2
.....
end
go