duchovnick
Programmer
Hi,
I need a stored procedure to recieve 2 table names as parameters and to delete those 2 tables.
My code is:
After execution of the procedure, the tables remain alive.
I guess the parameters were not found in "sysobjects".
Can anyone tell me how to do it right ?
Thanks a lot.
I need a stored procedure to recieve 2 table names as parameters and to delete those 2 tables.
My code is:
Code:
/*drop proc deleteTables*/
/*exec deleteTables j_11, j_12*/
CREATE PROCEDURE deleteTables @table1 VARCHAR(10), @table2 VARCHAR(10)
AS
BEGIN TRANSACTION
declare @xxx varchar(200)
set @xxx=
'
IF EXISTS (SELECT * FROM sysobjects WHERE name='+@table1+')
DROP TABLE '+@table1+'
IF EXISTS (SELECT * FROM sysobjects WHERE name='+@table2+')
DROP TABLE '+@table2+'
'
commit
go
I guess the parameters were not found in "sysobjects".
Can anyone tell me how to do it right ?
Thanks a lot.