mssql_v2005
asked on
SQL query+SQL Server
I want to delete rows from 3 tables based on ID column. Can you please share logic/or query to delete rows.
ex: 3 tables with the name of A,B,C
ID column exist on all 3 tables. I will pass ID as input parameter and want to delete rows from 3 tables from single query.
ex: 3 tables with the name of A,B,C
ID column exist on all 3 tables. I will pass ID as input parameter and want to delete rows from 3 tables from single query.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The DELETE command only accepts a table or a view name so I don't think you can't do it from a single statement.
If you want to achieve with your single query then you need to CREATE FOREIGN KEY with ON DELETE CASCADE
Best Regards
Best Regards
ASKER
This solution is working partially for me.
I think you were too fast to accept a solution.
Are the tables related? A delete trigger is an acceptable solution for you?
Are the tables related? A delete trigger is an acceptable solution for you?
ASKER