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
 Transact-SQL (2000)
 Delete

Author  Topic 

Richard Branson
Yak Posting Veteran

84 Posts

Posted - 2004-04-15 : 06:25:22
How can I delete all the records that are in one table (table X) from 15+ other tables but not deleting the records that are in the the first table (table X). The othe tables are all linked (primary & foreign relations) but not linked to the first table (Table X)?

You can't teach an old mouse new clicks.

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2004-04-15 : 06:32:25
DELETE FROM TableY
WHERE ID NOT IN ( SELECT ID FROM TableX) ?

Repeat for every table.

Does that do it ?



Damian
Go to Top of Page
   

- Advertisement -