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!

View Top Clause suddenly not working

Status
Not open for further replies.

diobbi

Technical User
Aug 19, 2002
6
0
0
Hi,

I am copying (via cut and paste)views from 1 database to another database of the exact same structure. Any of my views that contain the "Top and Order by" clause in them are no longer working. I now get the error "Incorrect syntax near 100" or whatever number I have there. The views work fine in the other database with these statements but won't work in the new database. All the other views I copied over without the "Top" statement in them worked fine.
Any ideas as to why the "Top" statement would work against one database and not another? Thanks.

Deb
 
My guess is that your NEW database is set with OLD version compatibility. Run the sp_dbcmptlevel against the database and see what version you are set for. Example:

EXEC sp_dbcmptlevel 'dbName' and it will show your your compatibility level. To change it:

EXEC sp_dbcmptlevel 'dbName', 80 -- this is for 2K
EXEC sp_dbcmptlevel 'dbName', 70 -- this is for 7
EXEC sp_dbcmptlevel 'dbName', 65 -- this is for 6.5

Hope this helps.
 
MeanGreen,

Thank you so much for your quick response and correct answer. I had spent days on this and never would of thought of that. The new database was set to 65. I changed it to 7 and now everything works fine. Thanks again.

Deb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top