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.
| Author |
Topic |
|
umapathy
Starting Member
24 Posts |
Posted - 2007-12-05 : 06:01:41
|
| Hi i have a two tables namely x,y.the desing structure of the table is below mentioned xid(primary key) address1 abc2 xyz3 asdyname date id(foriegn key)abc 2/dec/07 1xyz 3/dec/07 2here am want to delete id value 1 from table x. but it didn't allowe me to delete.then how can i delete a record from table x.ThanksUmapathy |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-12-05 : 06:06:42
|
| You have to delete child table's i.e. table y's - related record first before deleting record from X.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2007-12-05 : 11:46:06
|
| You can also make this happen automatically by using clause ON DELETE CASCADE with foreign key definition (i.e definition of col [name] in table y in the example).Then if you try to delete record with id 1, it will automatically delete the child tables record first and then deletes the main table record. |
 |
|
|
|
|
|