Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Tell me what do you mean by an execution plan? Why is it used? How would you view it?

878


How do I repair damaged sql server mdf file database? In previous day my mdf file has got damage due to unknown reasons then I used dbcc chekcdb command but it failed, MDF file is important for me, I don’ know that how to get back mdf file data. Please anyone suggest me?

1744


What is the difference between char and varchar2 datatype in sql?

1062


How to insert multiple rows with a subquery?

1125


What is reference section?

995


What is acid db?

879


Explain the properties of a relational table?

1015


Explain the categories of stored procedure i.e. System stored procedure, local stored procedure, temporary stored procedure, extended stored procedure, remote stored procedure?

1045


What is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure? How many levels of sp nesting is possible?

959


Explain what is dbcc?

1000


How to disconnect from a sql server using mssql_close()?

1101


Explain a differential backup?

1001


How you can add messages to the nt event log from within a stored procedure?

1061


Which is better statement or preparedstatement?

922


What is oltp (online transaction processing)?

1002