Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 delete query required in mssql 2000

Author  Topic 

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2009-08-26 : 02:24:10
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

hi the above query is working fine with sql server 2005.i want it in sql server 2000.help me out.

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-08-26 : 03:01:05
Hi once go through this

declare @t table (A int)
insert into @t select 1 union all select
1 union all select
1 union all select
2 union all select
2 union all select
3 union all select
3 union all select
3
select identity(int,1,1)as rid, * into #temp from @t

select a,(select count(a) from #temp where rid <= t.rid and a= t.a)as cnt
from #temp t
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-08-26 : 03:08:27
Search for delete duplicate+sql server in google

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2009-08-26 : 06:03:55
what is the equivalent for row_number in sql server 2000 as above query not work for it
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-08-26 : 06:12:21
quote:
Originally posted by rajasekhar857

what is the equivalent for row_number in sql server 2000 as above query not work for it




Check this out

http://senthilnagore.blogspot.com/2009/07/create-row-number-or-serial-no.html

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2009-08-26 : 07:18:19
hi tried a lot can you please give equivalent delete script in sql server 2000
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2009-08-26 : 07:47:55
Here is a better idea. Follow the link in my signature on HOW TO POST A QUESTION.
Give us the data asked for, and someone will likely show you what you need.

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -