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...


Write a query to delete duplicate records in SQL SERVER

Answers were Sorted based on User's Feedback



Write a query to delete duplicate records in SQL SERVER..

Answer / dharmesh

your table look like this and want to delete duplicate
record

chandran 23
ranjith 24
chandran 23


delete top(1) from tablename where name='chandran' and
age=23

Is This Answer Correct ?    3 Yes 28 No

Write a query to delete duplicate records in SQL SERVER..

Answer / sonia

Create table info(comp_id int identity(101,1),comp_name
varchar(50))
insert into info values('Progressive Ltd.')
insert into info values('Progressive Ltd.')
insert into info values('EliResearch')
insert into info values('Patni')
insert into info values('Accenture')
insert into info values('Accenture')
select * from info

DELETE FROM info
WHERE comp_name IN
(SELECT comp_name FROM info
GROUP BY comp_name HAVING COUNT(comp_name) > 1)

Is This Answer Correct ?    12 Yes 38 No

Write a query to delete duplicate records in SQL SERVER..

Answer / anil

delete from tab_nam where

Is This Answer Correct ?    2 Yes 30 No

Write a query to delete duplicate records in SQL SERVER..

Answer / skumar

Hi friends, please just try out this. This works fine for me.

We have lot of methods to do this. But using temp table,
drop the original table,retain the temp as orinial is not a
good pratice.

When u have large no of data it will affect ur performance.


DELETE FROM employee WHERE((SELECT eid,COUNT(eid) FROM
employee GROUP BY eid) > 1)

Is This Answer Correct ?    15 Yes 46 No

Write a query to delete duplicate records in SQL SERVER..

Answer / chandran.s

Table Name: Example

Name Age
chandran 23
ranjith 24
chandran 23

To delete one of the duplicate records use following query


delete from example where age in(select age from example
group by age having count>1)

Is This Answer Correct ?    13 Yes 46 No

Write a query to delete duplicate records in SQL SERVER..

Answer / chandran

There is a table like this: tablename: example


Name Age
chandran 23
ranjith 24
chandran 23

In this table the name:chandran and age:23 are the
duplicate records .so we need to delete this using this
sql statements


delete from example group by name,age having count>1

Is This Answer Correct ?    37 Yes 107 No

Post New Answer

More SQL Server Interview Questions

here id col have primary key and identity id name 1 a 2 b 3 c 4 d delete 2nd row then o/p will be id name 1 a 3 c 4 d next inssert 2nd row and i want o/p will be id name 1 a 2 e 3 c 4 d

7 Answers   IBM, TCS,


What is key attribute?

0 Answers  


explain what is a deadlock and what is a live lock? How will you go about resolving deadlocks? : Sql server database administration

0 Answers  


what is the primary use of the model database? : Sql server administration

0 Answers  


How to determine the service pack currently installed on SQL Server?

4 Answers   HCL,


Why is sql server log file full?

0 Answers  


Do comments need to go in a special place in sql server 2005?

0 Answers  


What is the main purpose of having conversation group?

0 Answers  


What is indexing?

0 Answers   AOL,


What is the most common type of join?

0 Answers  


What is the cartesian product of table?

0 Answers  


What are the types of resultset?

0 Answers  


Categories