Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSSQL TOP n equivalent in ASE11.9.2 or later?

Status
Not open for further replies.

AoN

Programmer
Oct 19, 2001
12
SE
I'm working on an application which will work against several DBMS's. I've found that if I use the MSSQL specific TOP n in one of my queries I cut time to a third.

I've been looking for an equivalent that for ASE.

Basically it returns either the TOP n percent, or the TOP n rows. I need something that returns only 1 row, as TOP 1 would do.

Is there a equivalent thing for SYBASE?


Bless!

AoN
 
In Sybase, you can use set rowcountn to select the 1st n rows. Once you've done this, make sure do a set rowcount 0 to ensure subsequent queries return all rows.

Greg.
 
Oh, I forgot to mension I need to use this function in a subquery.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top