August 6, 2010 at 11:50 am
August 6, 2010 at 11:52 am
ok cool cool.
Thanks.
😎
Billy
August 8, 2010 at 11:31 am
I'm a little late to this thread, but since this is live data, you should back up the table first so you can recover in case something goes wrong. If it's a fairly small table, then make a copy of it, named in such a way that you know what it is, and that the backup can be dropped later once you're sure it's not needed.
For instance, we create tickets for production changes. I would create a copy of the table as a backup and append the ticket # to it so it's clear why it's there: Table1_PCR123. Then I can look up PCR123 to see the job specs.
Also, I first do a select to see how many will get deleted, and look at them to make sure they are correct.
Then I put deletes & updates in a transaction so I can rollback if I realize I made a mistake:
begin tran
delete from table1 a
inner join table2 b on a.id = b.exa
inner join table3 c on b.mple = c.id
inner join table4 d on c.col = d.umns
where UserAcct like 'abcdefgh'
-- Ooops , meant to type: where UserAcct like 'XYZ'
rollback
or
commit -- everything looks good
Viewing 3 posts - 16 through 18 (of 18 total)
You must be logged in to reply to this topic. Login to reply