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

how to delete duplicate rows from table in sql server

Answer Posted / onlymoid

CREATE TABLE dbo.duplicateTest ------Deleting
Duplicates with same id
(
[ID] [int] ,
[FirstName] [varchar](25),
[LastName] [varchar](25)
) ON [PRIMARY]

INSERT INTO dbo.duplicateTest VALUES(1, 'Bob','Smith')
INSERT INTO dbo.duplicateTest VALUES(2, 'Dave','Jones')
INSERT INTO dbo.duplicateTest VALUES(3, 'Karen','White')
INSERT INTO dbo.duplicateTest VALUES(1, 'Bob','Smith')



SELECT * FROM dbo.duplicateTest

SET ROWCOUNT 1
DELETE FROM dbo.duplicateTest WHERE ID = 1
SET ROWCOUNT 0

SELECT * FROM dbo.duplicateTest

Drop table dbo.duplicatetest

Is This Answer Correct ?    5 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to disable stored procedure sql server?

1596


What are the differences between having and where clause.

962


What is a cursor, index in sql?

1064


How to create a user to access a database in ms sql server using "create user" statements?

943


What is the difference between locking and multi-versioning?

981


What are the basic features of a trigger in ms sql server?

1179


What is a trigger in sql server?

1159


How to create an index on a view?

1060


What is a result set object returned by odbc_exec()?

1016


What to perform pattern match with the like operator?

874


Explain filtered indexes benefits?

995


Tell me what are cursors and when they are useful?

944


What are transactions and its controls?

1051


Sql studio em braces a variety of capabilities, but will I need them all? Is there a simpler product ? : sql server management studio

898


What's the information that can be stored inside a bit column?

992