I'm running this query on SQL Server 2008 R2:

   orr.Rate, orr.ID, orr.UserKey, fn.NetRate 
   OngoingRate orr 
   dbo.GetRateNetView(orr.UserKey) as fn
   orr.UserKey = 5

I get the following error:

Incorrect syntax near '.'.

Please help

  • 2
    I've updated this answer to include this scenario as well. Still I'm not sure why you had to restart SQL Server - compatibility level changes should take place immediately. Are you 100% certain you were running the query in the context of the database where you changed the compat level? May 27 '14 at 16:00
  • Aaron Bertrand: Im Positive, it worked after the restart
    – Vuzi
    May 28 '14 at 7:28

The syntax you have is correct from SQL Server 2005 and up. You are using SQL Server 2008 so it should work just fine unless you have compatibility level for your database set to "SQL Server 2000 (80)".

Make sure you have compatibility level set to at least "SQL Server 2005 (90)".

Right-click on your database - Properties - Options

enter image description here

  • I was suspecting the same thing but I updated the compatibility level to SQL Server 2008(100). Let me restart sql server(just in case)
    – Vuzi
    May 27 '14 at 14:26
  • 1
    Hi Mikael, it turns out I had to restart the sql server service for the changes to take effect. Thanks for your contribution
    – Vuzi
    May 27 '14 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.