Jan 30, 2008

Eliminate sql server table duplicate rows

Eliminate sql server table duplicate rows

Scenario : company_list table content with duplicate rows , only want to keep one row .
Now , create table temp1 , column definition same with company_lis , then

1. SQL Server 2005 , right click upon table ,

















2. on table column , right click and choose “Indexes/Keys”

















3. choose Add , “Is Unique” -> Yes

















4. Then "Ignore Duplicate Keys" -> Yes




















5. Save the table , then issue the command insert into temp1 select * from company_list . You will get data with no duplication rows in temp1 table, now ,

0 意見: