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 Administration (2000)
 Script or Utility to check for Orphan records?

Author  Topic 

raekdoe
Starting Member

3 Posts

Posted - 2002-10-12 : 22:09:49
Hello All,
I am looking for a script or utility to run against my databse to check for orphan records. Then when it finds them to clean the tables up. Anyone know of such a thing?

TIA,
Kevin


Your as fast as your slowest link.

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2002-10-13 : 14:43:10
Check out this article to find items that don't exist in other locations.
http://www.sqlteam.com/item.asp?ItemID=448

You can write a stored procedure that does this for all the orphans your checking. You'll have to modify to be like:

DELETE FROM
(SELECT STATEMENT)



Go to Top of Page
   

- Advertisement -