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 |
sql_server_dba
Posting Yak Master
167 Posts |
Posted - 2012-02-16 : 20:42:28
|
Experts..need some input hereMy code works fine but couple of months back it got messed up and i did not cleaned the data properly. So any help would be aprecieated..I have a table with 4 columns A(INTEGER), B(DateTime), C(Integer), D(DateTime).So now here is how my data should look like....A B C D101 01-09-2010 1 02-11-2010101 02-11-2010 1 03-30-2010101 03-30-2010 1 12-15-2010101 12-15-2010 1 03-12-2011101 03-12-2011 1 12-01-2011101 12-01-2011 1 01-01-9999102 01-23-2011 4 08-23-2011102 08-23-2011 4 12-01-2011102 12-01-2011 4 01-01-9999But my data is messed up like A B C D101 01-09-2010 1 03-30-2010101 02-11-2010 1 03-30-2010101 03-30-2010 1 12-15-2010101 03-30-2010 1 03-12-2011101 03-12-2011 1 12-01-2011101 12-01-2011 1 01-01-9999How can i write the code to match up the data in it? I am not a great developer, so i have no idea about how to fix this. Any help would be really great!!!!! |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-02-16 : 20:58:42
|
firstly can you explain how to get from the messed data to the data you want ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
sql_server_dba
Posting Yak Master
167 Posts |
Posted - 2012-02-17 : 11:51:15
|
I thought i already explained that. Sorry if i am not so clear...here is the messed up data..A B C D101 01-09-2010 1 03-30-2010101 02-11-2010 1 03-30-2010101 03-30-2010 1 12-15-2010101 03-30-2010 1 03-12-2011101 03-12-2011 1 12-01-2011101 12-01-2011 1 01-01-9999and here is the required format...A B C D101 01-09-2010 1 02-11-2010101 02-11-2010 1 03-30-2010101 03-30-2010 1 12-15-2010101 12-15-2010 1 03-12-2011101 03-12-2011 1 12-01-2011 |
 |
|
X002548
Not Just a Number
15586 Posts |
|
sql_server_dba
Posting Yak Master
167 Posts |
Posted - 2012-02-18 : 16:49:02
|
OK...The date in column B of row2 should be same as the date value of Column D in record 1. Similarly, the date value in row 3 should start with the data value of column D in row 2 and it continues and the date value of column D in the last row should be 01-01-9999. |
 |
|
|
|
|