[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Strange SQL Update Issue

Posted on 2015-02-11
13
Medium Priority
?
169 Views
Last Modified: 2015-02-17
I am trying to run a simple update statement on a database.  Here is the update:

UPDATE dbo.TkprBudget
SET tkprbudget.TBBudHrsWrk = '2'
WHERE tbemp = '130' and tbprdyear = '2015' and TBPrdNbr = '1'

When I run it I get these errors:

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '+'.
Msg 208, Level 16, State 0, Line 1
Invalid object name '##XML'.

I have no clue what this is talking about.  There is no + sign and I dont know what object ##XML is referring to either.  Am I missing something obvious here?  This is SQL 2012.  Thank you for your help.
0
Comment
Question by:mattpayne59
[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
  • 4
  • 3
  • 2
  • +2
13 Comments
 
LVL 49

Expert Comment

by:PortletPaul
ID: 40604934
What is the relevance of Access to this question?

How are you running the update query?
0
 

Author Comment

by:mattpayne59
ID: 40604976
Sorry... Not sure how access got in there as a topic.  This is straight sql.

I am just running the query in the query window in SQL management studio.
0
 
LVL 49

Expert Comment

by:PortletPaul
ID: 40604995
Running [ only & just the displayed query ] in the query window in SQL management studio

I have no idea, sorry.
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
LVL 52

Expert Comment

by:Vitor Montalvão
ID: 40605101
Check if in that query window exists more code. If so, select only the statement that you want to run and press F5 or Execute button.
0
 

Author Comment

by:mattpayne59
ID: 40605389
It only has that code. I commented out the rest. I also connected using a 2008 management studio and copied that code in only to the query and I got the same issue. It is very strange.
0
 
LVL 52

Expert Comment

by:Vitor Montalvão
ID: 40605396
Then check if the TkprBudget has any update trigger.
0
 
LVL 14

Assisted Solution

by:Nakul Vachhrajani
Nakul Vachhrajani earned 664 total points
ID: 40605469
Get a Profiler trace with statement level details, and investigate if any cascading triggers and/or stored procedures are being executed as a result of this UPDATE statement. Chances are that some of that logic is using a temporary table with the name - ##XML and has overloads on the + sign (or is attempting to concatenate 2 strings) - which is where the failure is.
0
 

Author Comment

by:mattpayne59
ID: 40605627
I see the statement being executed in Profiler but I dont see anything else executing around it.  No stored procedures or triggers.
0
 
LVL 52

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 668 total points
ID: 40605652
Isn't that easy to see it in the Profiler. Use SSMS and check for the existence of triggers in the table.
0
 
LVL 70

Accepted Solution

by:
Scott Pletcher earned 668 total points
ID: 40605884
Run this command from within the db:

EXEC sp_helptrigger 'dbo.TkprBudget'
0
 

Author Comment

by:mattpayne59
ID: 40612674
Definitely some triggers... I dont think this is going to be possible with a simple update query then.  I will go another route.  Thank you for the help everyone.
0
 
LVL 70

Expert Comment

by:Scott Pletcher
ID: 40614443
You can always code a "bypass" in the trigger(s), to have it(them) exit without doing anything when you explicitly tell the trigger not to.  CONTEXT_INFO is the easiest way to do that.
0

Featured Post

Independent Software Vendors: 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

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…
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

656 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