SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


delete query required in sql server 2000


delete query required in sql server 2000

Author
Message
rajasekhar857
rajasekhar857
Grasshopper
Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)

Group: General Forum Members
Points: 12 Visits: 18
hi my delete query is working fine qith sql server 2005.please help me out giving query in sql server 2000.

DELETE D
FROM
(

SELECT *
,ROW_NUMBER() OVER (PARTITION BY problem_code, patient_id ORDER BY PROBLEM_ID DESC) AS RowNum
FROM EMRPATIENTPROBLEMS
) D
WHERE RowNum > 1
GO
Mahesh Bote
Mahesh Bote
SSCarpal Tunnel
SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)SSCarpal Tunnel (4.4K reputation)

Group: General Forum Members
Points: 4396 Visits: 1287
It seems that you are trying to delete duplicate records. What you have to do is to write a query in SQL Server 2K to return the duplicate records using HAVING clause and then delete those records.

Let us know on this,

Mahesh


MH-09-AM-8694
Slick84
Slick84
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2744 Visits: 1163
Check the below article out. It gives a nice explanation along with SQL 2000 and 2005 syntax and query idea's.

http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=DuplicateRows

Thanks,
S

--
Hehe
ChiragNS
ChiragNS
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11305 Visits: 1865
You can do a select distinct and insert the records in a new table , drop the old table and rename the new table to the original table. You can do this only if the table contains small or moderate amount of data. Make sure the new table contains all indexes, constraints etc.

"Keep Trying"
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search