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
 Transact-SQL (2000)
 Duplicate Rows

Author  Topic 

cgunner
Yak Posting Veteran

95 Posts

Posted - 2005-03-10 : 12:38:13
I have a table that has duplicate rows with the exception of one column in each of the duplicate rows. Example

Col001 Col002 Col003 Col004
Wilson Mary 123 Main ST NULL
Wilson Mary NULL 123-4567

I want to replace either NULL value in either record and get rid of the duplicate name. Final result:

Col001 Col002 Col003 Col004
Wilson Mary 123 Main ST 123-4567


Thanks.

X002548
Not Just a Number

15586 Posts

Posted - 2005-03-10 : 12:47:22
got a key?

what if there are more than 2 rows and different values?



Brett

8-)
Go to Top of Page

cgunner
Yak Posting Veteran

95 Posts

Posted - 2005-03-10 : 13:03:04
These are not all of the columns in the table. The rest of the columns are exact duplicates in each row. I do not have a PK but I guess I could put a rowid on each record to identify which row is which. The example pretty much shows my problem. I have one record with a NULL value on one record and it is populated on the other and the opposite for the other record. I don’t want to lose any data but I want to populate all of the columns and get rid of the other wise duplicate row.
Go to Top of Page
   

- Advertisement -