sp_deleteorphans.SQL

April 8, 1998



While cleaning up data you may create orphan records (before you have created FK constraints). This script purges orphan records from a child table. It takes the arguments of parent_table, child_table and linking_field and then finds all the child records with no parent record and deletes them.

For SQL Server 6.5

Author: Tom De Lancey


Download Script:
sp_deleteorphans.SQL


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... Disclaimer Continued


Back to Database Journal Home








The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers