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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 updating table rows, urgent please.

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 Number1Number2
Rafael Ou 95243 56542
XXXXXX In 45435 90876
XXXXXX Ou 64563 10000
hol Ho In 10000 98769
XXXXXX In 64509 54687
XXXXXX Ou 53948 10000
Tondaa In 10000 21938
Jeremy Ou 34987 34658

Thank 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.
Go to Top of Page

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.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-07 : 01:34:28
Post your expected result

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -