Solved

ADO error: Incorrect syntax near 'TABLOCKX'.

Posted on 2012-03-21
13
1,717 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

687 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