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
 complex delete query help.

Author  Topic 

Sidster
Starting Member

7 Posts

Posted - 2007-07-27 : 12:18:19
Hello,

I have a db with 4 tables are linked by different fields. I'll setup a general layout for you in hopes of getting some assistance with write a delete query based on a date range. T is table, f is field.

T1.F1 = T3.F1
T1.F2 = T2.F2
T1.F3 = T4.F3
T1.F4 = T2.F4 {DATE}

so as you can see, this will be an embedded delete of some type but I have to somehow cache the deleted values so that these values can be used for the parent delete (I think).

I'm new to this stuff so...let me know if my approach is wrong. Perhaps it was a poorly written db. I have to purge about 5GB worth of data.

Thanks in advance,
Sid.

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-07-27 : 12:25:15
Can you explain what you mean by >>>>> somehow cache the deleted values so that these values can be used for the parent delete (I think).

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

Sidster
Starting Member

7 Posts

Posted - 2007-07-27 : 15:32:35
Thank you Dinakar.

I'm not really sure what I need to do at this point....just fishing for some suggestions. I'm deleting records across all four tables without a cascade delete because there are no relationships established, I just don't know how to go about purging these records. The db wasn't developed efficiently, I suppose.
Go to Top of Page
   

- Advertisement -