sql server 2000: getting top N rows -


i'm running simple query gets top 5000 rows of table:

  select top 5000           accountid, account, accountmanagerid, mainphone, alternatephone, fax, email, webaddress, createuser, modifyuser, createdate, modifydate, addressid, shippingid      sysdba.account     1 = 1       , 1 = 1  order accountid asc 

this worked on sql server 2008, unfortunately find myself trying run formerly working script against sql server 2000. seems reject top command.

what should 5000 rows on version of sql server?

top keyword isnt available in sql server 2000. can use rowcount filter top records. can modify above query below:

 -- 1=1 not needed unless appending string dynamic sql  set rowcount 50 select           accountid, account, accountmanagerid, mainphone, alternatephone, fax, email, webaddress, createuser, modifyuser, createdate, modifydate, addressid, shippingid      sysdba.account  order accountid asc  

Comments

Popular posts from this blog

sql - text truncated using perl DBI insert -

c++ - Is it possible to compile a VST on linux? -

php - Pass object by reference or value -