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 2008 Forums
 Other SQL Server 2008 Topics
 Delete Query

Author  Topic 

Codesearcher
Starting Member

8 Posts

Posted - 2011-10-27 : 09:06:25
Hi
I have to delete few records from the base table.
Eg:
Delete from Tablea where col5 >=7000.
I have a reference table which has the Primary- foreign key created.
say, Col1 is the primary key for tablea and the same table is created as the foreign key i table b.
If i want to delete the corresponding records from table b how should we write a query?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-10-27 : 10:12:20
Delete from tableb first and then tablea

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-27 : 12:11:39
or set on cascade delete option for the fk in tableb

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -