Solved

ADO error: Incorrect syntax near 'TABLOCKX'.

Posted on 2012-03-21
13
1,704 Views
Last Modified: 2012-06-27
Microsoft Office 2010 using an .adp file to connect to a SQL Server 2008 R2.

When trying to make modifications (increasing column size, setting/removing PK's/identity) we randomly come across the following error:


ADO error: Incorrect syntax near 'TABLOCKX'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required. See SQL Server Books Online for proper syntax.

This did not start occurring until these databases were moved from SQL Server 2005 (and upgraded using RESTORE) to SQL Server 2008
0
Comment
Question by:PatrickLabbett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 2
13 Comments
 
LVL 40

Expert Comment

by:lcohan
ID: 37749814
"This did not start occurring until these databases were moved from SQL Server 2005 (and upgraded using RESTORE) to SQL Server 2008"

Sorry to ask but are you sure? As far as I recall this was introduced since SQL 2005 where table hints require WITH in front of the TABLOCKX(or NOLOCK,...) or any other hint. This was a change since SQL 2000 to 2005.
0
 
LVL 40

Expert Comment

by:lcohan
ID: 37749834
Here's one link to support that but regardless - you must change your code to fix that syntax error as there is no workaround or "wrapper" that you could use as far as I'm aware:

http://blogs.imeta.co.uk/sgoodman/archive/2008/12/16/539.aspx
0
 

Author Comment

by:PatrickLabbett
ID: 37749926
We are using Access projects ( Somefile.adp) that connects to SQL Server 2008. This error occurs when using "Design view" and making changes (ranging from increasing the size of an nvarchar column or setting a identity/pk.) The error comes up when trying to save the change in Access.

We can't "change the code" as it's happening through the Access Design View interface.

We never saw anything related to TABLOCKX previous to moving the databases to SQL Server 2008. Databases that still reside on our SQL 2005 server are not experiencing this issue.
0
Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 37750606
it's happening through the Access Design View interface.
Than consider using SSMS to make changes instead of MS Access.
0
 

Author Comment

by:PatrickLabbett
ID: 37751019
Our staff are restricted to using Access as SSMS isn't necessary for their normal workflow, leaving the chore of our senior IT staff to resolve it. We are trying to avoid that timesink.
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 250 total points
ID: 37755578
Our staff are restricted to using Access as SSMS isn't necessary for their normal workflow
I guess you have found an exception to that rule here.  In any case good luck.
0
 

Author Comment

by:PatrickLabbett
ID: 37767584
Unfortunately, as mentioned, that isn't possible. These employees do not know SQL. It's outside their core ability, training, and workflow. This is why we need Access for them to make simple changes. I will continue to search for an answer.
0
 

Author Comment

by:PatrickLabbett
ID: 37779496
Microsoft has replied with the following information:

http://social.msdn.microsoft.com/Forums/en-US/accessdev/thread/e07ee680-55fc-4d43-95b6-7696d16c714f/

Hi Patrick,

So, I was able to reproduce the error message you were seeing when trying to modify the design of your table in an ADP connected to SQL 2008:  "-Unable to modify table.  ADO error: Incorrect syntax near 'TABLOCKX'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required. See SQL Server Books Online for proper syntax."

We have filed this issue and the developers will be continuing to investigate it.  At this point I would recommend continuing to use the workaround you currently have or giving users SQL management studio so they can make design changes directly in SQL Server.

Thanks,

Kirk

Kirk Beller

Microsoft Online Community Support
0
 

Author Comment

by:PatrickLabbett
ID: 37779501
While this did not resolve the actual issue I was trying to fix, Microsoft has confirmed that it's an issue with their product so the only way to fix the issue (as opposed to working around it) is to wait for an update to their product line.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 37779888
Since the chances MS will fix this in the near future if ever, you may want to consider changing the database compatibility level to 80 (SQL Server 2000, the last time this syntax was supported.  I have tested with this setting and it does work with the deprecated syntax.
0
 

Author Closing Comment

by:PatrickLabbett
ID: 37801811
I've regraded, and based on the "Grading Tips":

If you have given the Expert(s) ample time to respond to your clarification posts and you have responded to each of their posts providing requested information, or if the answers, after clarification, lack finality or do not completely address the issue presented, then a "C" grade is an option. (Note: The use of a C in a vindictive manner is likely to be changed by a Moderator.)

I have found the C grade to be the most appropriate since the answer did "lack finality or do not completely address the issue presented."
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 37808867
SouthMod,

Don't worry about the points awarded in this thread.  This is the first question the author has posted and I am sure with time he/she will get a better understanding of how it works here.  Sometimes educating users takes time.

Thanks,
Anthony
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question