Delete
Duplicate Data without Using primary key and Identity key:
Example:
Id
|
Name
|
1
|
Test
|
1
|
Test
|
1
|
Test
|
USE Test
Go
WITH Duplicates AS
(
SELECT Name,Id,
ROW_NUMBER() OVER (PARTITION BY Id,Name ORDER BY Id) AS 'RowNum'
FROM dbo.TestDuplicates
)delete FROM Duplicates WHERE RowNum>1
SELECT * FROM dbo.TestDuplicates
After using this:
Id Name
1 Test
Post By : Urvish Patel
Blog By : Dipen Shah
Stay Tuned...We rocked...
Informative article, just what I was looking for. Keep on posting these types of useful tips.
ReplyDeleteHistorical Options Prices