From: Plamen Ratchev on 26 Apr 2010 12:58 In that case it will be more difficult. I would suggest to alter the table and add primary key column(s) to identify each row uniquely. Otherwise you are up to some tricky SQL to add IDENTITY column and based on that remove duplicates. Or insert all rows into another table using DISTINCT and then drop the original table and rename the new table to the original name. -- Plamen Ratchev http://www.SQLStudio.com
From: fniles on 26 Apr 2010 14:20 > I would suggest to alter the table and add primary key column(s) to > identify each row uniquely How do I identify the rows that are not unique during the table alteration ? When I tried to add the primary key consisting of SequenceNumber and Symbol, it gave me the error that says some records are not unique, or something like that. "Plamen Ratchev" <Plamen(a)SQLStudio.com> wrote in message news:cPednYQy04WxW0jWnZ2dnUVZ_gCdnZ2d(a)speakeasy.net... > In that case it will be more difficult. I would suggest to alter the table > and add primary key column(s) to identify each row uniquely. Otherwise you > are up to some tricky SQL to add IDENTITY column and based on that remove > duplicates. Or insert all rows into another table using DISTINCT and then > drop the original table and rename the new table to the original name. > > -- > Plamen Ratchev > http://www.SQLStudio.com
From: Plamen Ratchev on 26 Apr 2010 16:58 You have to add another attribute to make the combination unique. Or just clean up the data as I explained, by inserting into new table using DISTINCT. When data is clean add UNIQUE constraint (or PRIMARY KEY) on {SequenceNumber, Symbol}. -- Plamen Ratchev http://www.SQLStudio.com
From: fniles on 30 Apr 2010 15:04 Thanks "Plamen Ratchev" <Plamen(a)SQLStudio.com> wrote in message news:qpqdnYDzYszOY0jWnZ2dnUVZ_qcAAAAA(a)speakeasy.net... > You have to add another attribute to make the combination unique. Or just > clean up the data as I explained, by inserting into new table using > DISTINCT. When data is clean add UNIQUE constraint (or PRIMARY KEY) on > {SequenceNumber, Symbol}. > > -- > Plamen Ratchev > http://www.SQLStudio.com
First
|
Prev
|
Pages: 1 2 3 Prev: Particular query problem Next: Leading and trailing spaces trimmed with SQL XML |