Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Dynamic Table Names in a SPROC

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-02-01 : 23:40:09
Bill writes "Is it possible to create a stored procedure that will accept a table name as a parameter. Like a procedure that will delete from different tables based on the table name passed.

CREATE PROCEDURE sp_delete_table_rows
@tableName varchar,
@rowID int

AS
DELETE FROM @tableName
WHERE rowID = @rowID

GO

I get a declaration error with the above example.
SQL Server 2000/Windows 2000 Advanced Server

Thanks,
Bill"
   

- Advertisement -