if 3 duplicate records in a table,i want to delete 2 duplicate
records by keeping 1 duplicate and 1 original as it is,how?
Answer Posted / dhananjay
The simplest way to eliminate the duplicate records is to
SELECT DISTINCT into a temporary table, truncate the
original table and SELECT the records back into the original
table. That query looks like this:
select distinct *
into #holding
from dup_authors
truncate table dup_authors
insert dup_authors
select *
from #holding
drop table #holding
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to make a column nullable?
What is the security model used in sql server 2005?
Write a SQL query to delete a table?
Can select statements be used on views in ms sql server?
What is difference between Datepart() and Datename() in SqlServer?
how many triggers you can have on a table? : Sql server database administration
What is a cache in ssrs?
When is update_statistics command used?
where can you add custom error messages to sql server? : Sql server administration
How to trouble shoot if unable to connect SQL Server
What do you understand by the denormalisation?
can you instantiate a com object by using t-sql? : Sql server database administration
How to loop through result set objects using mssql_fetch_array()?
as a part of your job, what are the dbcc commands that you commonly use for database maintenance? : Sql server database administration
Where to find ntwdblib.dll version 2000.80.194.0?