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 statement

Author  Topic 

cognos79
Posting Yak Master

241 Posts

Posted - 2006-10-13 : 15:24:43
can I delete records from two tables using a single sql statement.

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-10-13 : 15:31:11
No, INSERT, UPDATE and DELETE all work on a single table at a time. Want to modify data in two tables, then you must execute two statements.
Go to Top of Page

cognos79
Posting Yak Master

241 Posts

Posted - 2006-10-13 : 15:31:31
Thanks...
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-10-16 : 04:41:50
if the tables are linked and there is cascade delete, possible
deleting the parent record deletes the child records

but I guess the question is of different nature

--------------------
keeping it simple...
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-10-16 : 05:33:58
You probably need a transaction if you need to use two statements - so that the first one can be rolled back if the second one fails!

Kristen
Go to Top of Page
   

- Advertisement -