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 |
|
mabhireddy
Starting Member
1 Post |
Posted - 2006-03-06 : 11:24:23
|
| I have abig table of 2000 rows, in that table i have some dirty data in the type of 10000, so i need to update 10000's in number1 column with 2nd previous number of the same row and delete previous 2 rows ie., no more xxxxxxxxxxx rows. can someone help me with this prob.Name type Number1Number2Rafael Ou 95243 56542XXXXXX In 45435 90876XXXXXX Ou 64563 10000hol Ho In 10000 98769XXXXXX In 64509 54687XXXXXX Ou 53948 10000Tondaa In 10000 21938Jeremy Ou 34987 34658Thank you. |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-03-06 : 12:50:45
|
| Not clear enough,1. How do you determine previous, next ... (do you have any order by field) ? (Its meaningless to consider data in a SAL server table as Previous ... since the order is not what v assume) 2. Is ur concern is only to delete rows that doesn't have number1 as 10000 then Delete from urtbl where Number1 <> 10000 which will delete all records except for those having Number1 as 10000 I assume that u don't have Name as XXXXXX (if that is like that, u can use that also to select the records for deleting) 3. Do u want to update the remaining records as well ? If so how ? If needs to update with the Number1 in the one above (in ur sample data - which v don't know how to find those without knowing a proper sort criteria) Give the output u expect after the Delete / Update Process. |
 |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2006-03-06 : 13:06:50
|
| You're not trying to renumber an identity column, I hope. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-03-07 : 01:34:28
|
| Post your expected resultMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|