SQL Server Performance

Weird behaviour with TOP 1

Discussion in 'General Developer Questions' started by nilayinc, Jan 26, 2004.

  1. nilayinc New Member

    Hi,

    I have SQL Server 2000 and have multiple database. Say database A and Database B. There are stored procedure in A which is refering to tables of B. Everything is working fine except for the TOP 1 clause.. When I try to execute the same thing through query analyser also it is resulting in same error message..

    USE A
    Select * from B..Table1
    - Above works fine

    USE B
    select * from B..Table1
    -- This also works fine

    USE B
    select TOP 1 * from B..Table1
    - this also works fine

    But
    USE A
    select TOP 1 * from B..table1
    -- this results into Line 2: Incorrect syntax near '1'.

    Dont know the reason why?

    Any help would be appreciated.

    Thanks
    Nilay.

  2. Twan New Member

    Database A is set to a compatibility level before 80. Check the Options tab on the database properties

    Cheers
    Twan

Share This Page