Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server-2008
hello
 
is there any way to write a procedure to delete two tables specific row which they have relation with each other?
 
and the same question for update these two tables?
Posted 25-Dec-12 22:34pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

HI,
 
Yes you can delete the specific rows of the two tables that are in relation to each other. If the two tables are in a relation of foreign key then you can delete the row by setting the cascaded delete option to on.
 
There is one more way to delete the record from the table. Add a column to the tables named as "IsDeleted" of type "Bool" then make the particular record value to set true in that column. This is mostly used in industries.
 
From these above two options you can chose any one. But preferably the 2nd option is widely accepted.
 
Thanks
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 375
1 Sergey Alexandrovich Kryukov 217
2 OriginalGriff 210
3 Peter Leow 135
4 Uma Shankar Patel 80
0 OriginalGriff 7,380
1 DamithSL 5,359
2 Sergey Alexandrovich Kryukov 4,944
3 Maciej Los 4,906
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 26 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100