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 2000 Forums
 Transact-SQL (2000)
 How to capture ROWNUM in SQL Server without using Identity TBL or Alter Add rownum

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-12-22 : 08:29:35
Jarmal writes "I am attempting to convert the following PL/SQL statement into T-SQL..... The statement is used for data chunking which returns 3000 rows at a time.....This prevents all records from a table from loading into a table. $PrevRowNum$ is set to 0 and $NextRowNum$ is set to 3001. Could you please help?

select min(c1), max(c2) from (( (select c1, c2 from ( select request_id as c1, request_id as c2 from hpd_helpdeskelapseddays where Category = '" + $tmpCategory$) + "' AND
ArrivalYear = '") + $Year$) + "' order by request_id ) where rownum<") + $NextRowNum$) + " ) )
minus ((select c1, c2 from (select request_id as c1, request_id as c2 from hpd_helpdeskelapseddays where Category = '") + $tmpCategory$) + "' AND ArrivalYear = '") + $Year$) + "' order by request_id ) where rownum<") + $PrevRowNum$) + ")))"

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2003-12-22 : 11:06:11
Search here for topics entitled...WHAT'S AFTER TOP.
The runnum construct in Oracle isn't available directly in SQL....you'll have to simulate it.
Go to Top of Page
   

- Advertisement -