Dynamic Deletes : Delete Statement « Transact SQL « SQL Server / T-SQL Tutorial






4>
5>
6>
7>
8>     CREATE PROCEDURE prDeleteData
9>         @chvTable VARCHAR(30)
10>     AS
11>     DECLARE @chvSQL VARCHAR(255)
12>     SELECT @chvSQL = 'DELETE ' + @chvTable
13>     EXEC (@chvSQL)
14>     GO
1>
2>     drop PROCEDURE prDeleteData;
3>     GO
1>








20.14.Delete Statement
20.14.1.Archiving end user data.
20.14.2.Creation Script for the usp_EmployeeDelete Stored Procedure
20.14.3.Delete record in a stored procedure by parameter
20.14.4.Dynamic Deletes
20.14.5.Deleting Rows in Chunks