Top n works inconsistently

Results 1 to 2 of 2

Thread: Top n works inconsistently

  1. #1 Guest

    Default Top n works inconsistently

    I've got an odd issue. I've set up a Database on a SQL 7.0 server. When I create a query using "TOP 10" the server says "Invalid value near 10". However if I query against "Master" or 80% of the other db's I have on my server it works fine. I can even query against the table in the "bad" database by referenceing it (ie tableName.dbo.Messages) and get the information I want. But this creates a very polluted system. I can't see any difference between the way the 20% of the DB's are configured and the 80%. Anybody know what this might be?

  2. #2
    Jeremy_D Guest

    Default RE: Top n works inconsistently

    The databases against which the TOP N queries do not work are probably still in 6.5 compatibility mode. 6.5 didn&#039;t support the TOP N clause.<BR><BR>To check the compatibility mode of a database, execute the folowing code from QA:<BR>EXEC sp_dbcmptlevel @dbname = &#039;YourDatabase&#039;<BR>It will probably say 65 or 60 for those databases.<BR><BR>To change it to 7.0 compatibilty mode:<BR>EXEC sp_dbcmptlevel @dbname = &#039;YourDatabase&#039;, @new_cmptlevel = 70<BR><BR>Cheers,<BR>Jeremy<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts