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 |
|
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-11-20 : 04:43:17
|
| and we would start by finding the receiptID from the DA linking on EntryID where the DA is the one we are interested inwould this code be right for the above statementselect da. DebitAuthorityID, r.ReceiptID, cl.EntryIDFrom DebitAuthority dainnerjoin dbo.DebitAuthorityJournal dajon daj.DebitAuthorityID = da.DebitAuthorityIDinner join dbo.Clientledger clon cl.EntryID = daj.EntryIDinner join dbo.Receipt ron r.EntryID = daj.EntryIDwhere da. DebitAuthorityID = '5386' |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-20 : 05:50:21
|
| didnt get what you're asking for. can you explain? |
 |
|
|
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-11-20 : 05:58:12
|
| i have to delete a receipt from a table but it is reference in a few tables the one s above. need to get the entryid to delete iti have a database design i could post might explain it better |
 |
|
|
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-11-20 : 06:05:01
|
| how do u post an image here. i might be able to explain it better that way |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-20 : 06:17:05
|
quote: Originally posted by rjhe22 i have to delete a receipt from a table but it is reference in a few tables the one s above. need to get the entryid to delete iti have a database design i could post might explain it better
you need to find & delete dependent records from referred tables before deleting it from master table, if thats what you were asking. |
 |
|
|
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-11-20 : 06:22:03
|
| yes basically |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-20 : 06:29:17
|
| look into foreign key relatinships and start from child table backwards deleting records. |
 |
|
|
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2008-11-20 : 06:32:17
|
| ok is there any sample u could put up so i could see not sure how to do that |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-20 : 06:33:26
|
quote: Originally posted by rjhe22 ok is there any sample u could put up so i could see not sure how to do that
you need nothing more than a series ofDELETE FROM table WHERE...statements |
 |
|
|
|
|
|