This is a discussion on delete the duplicate within the SQL Server forums, part of the Database category; How to delete the duplicate row from a table without using cursor in microsoft sql server If any one know ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi Sandeep,
Trying out for a best solution but is giving some error........... Meanwhile if it is very urgent ........ you can use this ......... ofcourse this is not recommended .......... CREATE PROCEDURE dbo.PROC_Eliminate_Duplicate_Rows AS SET NOCOUNT ON CREATE TABLE #TBL_Duplicate (EMPNo int, EMPName varchar(50)) INSERT INTO #TBL_Duplicate SELECT DISTINCT * FROM EMP_Duplicate DELETE EMP_Duplicate INSERT INTO EMP_Duplicate SELECT * FROM #TBL_Duplicate SELECT * FROM EMP_Duplicate RETURN Regards, Jagadish Babu |
|
|||
|
Hai Sandeep,
Please try SET ROWCOUNT 1 DELETE temp_test FROM temp_test a WHERE (SELECT COUNT(*) FROM temp_test b WHERE b.name = a.name and b.value = a.value) > 1 WHILE @@rowcount > 0 DELETE temp_test FROM temp_test a WHERE (SELECT COUNT(*) FROM temp_test b WHERE b.name = a.name and b.value = a.value) > 1 SET ROWCOUNT 0 Regards, Srichand |
![]() |
| Thread Tools | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Eliminating Duplicate Rows from Flat File | cyrus | Data Warehousing | 2 | 08-24-2007 08:16 AM |
| Retain Duplicate | cyrus | DB2 | 1 | 03-13-2007 10:09 PM |
| How to delete duplicate rows from a table | athermaliq | Oracle Tutorials | 5 | 01-17-2006 12:03 AM |
| Looking for a utility that will delete middle directories | mraymus | Software Patterns | 1 | 06-16-2004 03:44 PM |
| [FAQ] FileMaker Pro - database for Macintosh and Windows | Martin Trautmann | Tech FAQ | 0 | 04-17-2004 07:26 AM |