This procedure will generate a delete stored procedure against a provided table and column name in your database. It will search for foriegn key constraints and create a delete statement for each one found in the database. The procedure has three parameters:
@table_name nvarchar(128) = the name of the source table
@column_name nvarchar(128) = the name of the source column
@new_proc_name nvarchar(128) = the name of the new procedure that will be generated.
Output the results from this procedure to text (or file) and then copy the results in order to create the procedure.
Please study the resulting delete statements to make sure that they do not violate the rules of your database.
Harnessing SQL Server Metadata- Disabling and Rebuilding Indexes
When doing bulk data changes it may be beneficial to disable indexes prior to starting the operation. Fortunately, SQL's rich metadata makes this very easy to automate in a robust fashion.
2018-05-18 (first published: 2015-10-19)
4,884 reads