This procedure will generate a delete stored procedure against a provided table and column name in your database. The script searches for foriegn key constraints and then creates 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 they do not violate the rules of your database.
Author: Jason Bohanon
Disclaimer: We hope that the information on these script pages is
valuable to you. Your use of the information contained in these pages,
however, is at your sole risk. All information on these pages is provided
"as -is", without any warranty, whether express or implied, of its accuracy,
completeness, or fitness for a particular purpose...
Back to Database Journal Home