TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Amol
NA
208
193.6k
Delete Duplicate Rows From Table In Sql Server with No Identity Column in table
Jul 29 2012 4:42 AM
If you want to delete Duplicate rows from sql server table with no identity column here is the trick
Consider table given below say sampletable
id data
1 A
2 B
1 A
3 C
1 A
2 B
1 A
If you want to delete duplicate rows in sql server
here is the trick with
common table expression
as given
WITH CTE AS
(
SELECT *,RN=ROW_NUMBER() OVER (PARTITION BY id ORDER BY id DESC) FROM sampletable
)
DELETE FROM CTE WHERE RN > 1
Reply
Answers (
2
)
SQL Profiler in SQL Server
SQL Distinct