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 cannot DELETE
from multiple tables with a single expression in SQL 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 an ON
DELETE
trigger
.