This is the query I'm using:
DELETE TB1.*, TB2.*
FROM TB1
INNER JOIN TB2 ON TB1.PersonID = TB2.PersonID
WHERE (TB1.PersonID)='2'
It's working fine in MS Access but getting error (Incorrect syntax near ','.) in SQL Server Express 2005.
How to solve it? Please help.
You can use something like the following:
you can join like this
but as Alex mentioned, only one at a time.
You need cascade constraint on the table to do all at once
This cannot be done in one statement. You will have to use 2 statements
You cannot
DELETE
from multiple tables with a single expression inSQL 2005
- or any other standard SQL for that matter.Access
is the exception here.The best method to get this effect is to specify
FOREIGN KEYS
between the table with anON
DELETE
trigger
.