Quantcast

SQL question

douglas

Chocolate Milk Doug
May 15, 2002
9,887
6
Shut up and Ride
running 7.0

I have a table with duplicate records (I assume when we moved servers the table was imported twice)
Is there a quick or easy way to get rid of the dupes?

I tried to manually delete one row and I get this error:
key column information is insufficient or incorrect. Too many rows were affected by update.
 

mcgowanc

Monkey
Jan 22, 2004
202
0
Boulder CO
douglas said:
running 7.0

I have a table with duplicate records (I assume when we moved servers the table was imported twice)
Is there a quick or easy way to get rid of the dupes?

I tried to manually delete one row and I get this error:
key column information is insufficient or incorrect. Too many rows were affected by update.
(i am assuming 7.0 means sql server)
1) you might be able to use the row_id/row id - I forget what oracle does and sql server doesnt.
2) you might also use the select top 1
3) you could add a new autonum or index field so that those rows are now unique - > you might have to do a group by / and a join and top one -> to first get the records that are dupped, then select the first one, and delete it.

GOOOOOOD LUCK!
Good luck.
 

douglas

Chocolate Milk Doug
May 15, 2002
9,887
6
Shut up and Ride
yes SQL server

1 huh?

2 huh?

3 I did do a new index, but like I said I got anerror when trying to delete

ps: my company is too cheap to send me to a SQL class so I really have no clue, kinda scary being I'm the only one hear that knows anything about SQL and we run our business on it
 

mcgowanc

Monkey
Jan 22, 2004
202
0
Boulder CO
douglas said:
yes SQL server

1 huh?

2 huh?

3 I did do a new index, but like I said I got anerror when trying to delete

ps: my company is too cheap to send me to a SQL class so I really have no clue, kinda scary being I'm the only one hear that knows anything about SQL and we run our business on it
-- I have to get some stuff done - But I will play around a little today maybe around lunch time - and see if I can get you some more detailed directions :)