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
 General SQL Server Forums
 New to SQL Server Programming
 delete with join

Author  Topic 

mana
Posting Yak Master

102 Posts

Posted - 2015-01-22 : 04:39:00
i have two tables and one of them will be updated according to another
when a row will be deleted from one tables it should be deleted from the other one as well. but i don't know exactly how. can you help me please?

delete from (delete from (Reporting.dbo.Nacharbeitmanagement_From_AQISdatabase
left join AQIs.dbo.v_Nacharbeits_Forcast on

i don't know how to write it and i am new to sql server. can you help me please?

viggneshwar
Yak Posting Veteran

86 Posts

Posted - 2015-01-22 : 05:29:22
1. If those two tables are having foreign key constraint then it has an option ON DELETE CASCADE
2. Those tables cannot have foreign key constraint then you could create a trigger for that table. in that trigger delete other table.

Regards
Viggneshwar A
Go to Top of Page
   

- Advertisement -