SQL Server Performance Forum – Threads Archive
Data Cleanup help needed
I have a table with roughly 3 million rows and 30 fieldsI need to "clean the data" that has non consecutive data values So I have something like this:
fld1 | fld2 | fld3 | fld4
———————————
wq1 | | oi2 | lk3
| ty1 | rt2 |
az1 | mn2 | po3 | er4
| | | uu1
I need to have something like:
fld1 | fld2 | fld3 | fld4
———————————
wq1 | oi2 | lk3 |
ty1 | rt2 | |
az1 | mn2 | po3 | 4er
uu1 | | | ANY help guidence will be greatly appreciated!!!! (Im looking into using a curser as we speak to see if I can do it) Even if I could get some way of identifying problem records using 1 or more SELECT’s that would be helpful
If I understand right, check out CASE and COALESCE in BOL. Perhaps this thread will help you, too:
http://www.sql-server-performance.com/forum/topic.asp?TOPIC_ID=12378 —
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Heute schon gebloggt?http://www.insidesql.de/blogs
I think both will work… I just need to figure out how properly contruct…
If you could advise with my 4 field example that would be helpful
Something like
Select Coalesce(fld1,fld2,fld3,fld4) as fld1 ,Coalesce(fld2,fld3,fld4,fld1) as fld2,Coalesce(fld3,fld4,fld1,fld2) as fld3,Coalesce(fld4,fld3,fld2,fld1) as fld4 from yourTable
Madhivanan Failing to plan is Planning to fail
Hm, turns out to be more tricky than I thought at first. As this is a one-time action I would probably resort to a cursor or write some script in DTS. —
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Heute schon gebloggt?http://www.insidesql.de/blogs
]]>