Hi, a program I was running which rebuilds tables messed up a clients database wiping out over $300000. All the data is still there, just in new tables prefixed with an X
for example ... InvoiceHeader (now empty), is called XInvoiceHeader
What I have managed to do so far is this
Code: select Name, case when left(name, 1) = 'x' then substring(name, 2, 50) else name end as Rename, Object_ID
from [url removed, login to view]
where name not like 'xhs%'
order by rename, name
A sample of the results ...
Code: select * from #DC_TEMP
Access Access 1768354060
XAccess Access 1209732058
AcctAccess AcctAccess 1800354174
XAcctAccess AcctAccess 1257732229
ACode ACode 1832354288
XACode ACode 1305732400
ActionCond ActionCond 1864354402
XActionCond ActionCond 1353732571
ActionDetail ActionDetail 1896354516
XActionDetail ActionDetail 1401732742
So for the first row, the 1st and 2nd columns have the same name, so what I need to do is make sure the script sees that, it means its an original table.
Code: SELECT COUNT(*) FROM Access
If that comes back as 0 then I want to take the Rename column and rename the table to Rename+'_BAK'
Then take the second line XAccess and rename it to Access, essentially putting all the data back in the right spot
11 freelancers are bidding on average $180 for this job
I am a SQL Server database administrator with over 7 years of experience in production support. I am a Microsoft Certified Technical Specialist in SQL Server 2008.
Hi, I have over 10 years experience as a SQL Server DBA. Most of this time was spent at banks and insurance companies. I can take care of this within the next 12 hours if you want. Regards, Brian