OT: Sybase Equivelant to MS SQL TOP?

  • Hi,

    I rountinely use SELECT TOP 10 * FROM TABLE to get an idea of what data I am dealing with in a table.

    I am doing a bit of a work on a Sybase Adaptive Server Enterprise and the same sql as I would use in MS, fails in Sybase.

    Is there a similiar function in Sybase SQL?

    Cheers,

  • You have to do

    SET ROWOCOUNT 5

    SELECT ...etc

    Primitive

    There is a hell of a lot that Sybase doesn't seem to do. DBCC SHOWCONTIG, DBCC DBREINDEX etc.

    I've been trying to find out a way of defragging indexes and the only way that I have found of doing it is to drop and create the damn things as I had to do in the prehistoric days of SQL 6.5

    He was not wholly unware of the potential lack of insignificance.

  • Sybase had TOP (and a synonym, FIRST) the last time I used it, several years ago. It did not have PERCENT or WITH TIES options, though.

    --Jonathan



    --Jonathan

  • Hi,

    Yep, This works :

    SET ROWCOUNT 5

    SELECT * from PATIENT

    However this :

    SELECT top 5 * from PATIENT

    returns the following error

    Server Message: Number 102, Severity 15

    Server 'hhie', Line 1:

    Incorrect syntax near '5'.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply