?
Solved

Strange SQL Update Issue

Posted on 2015-02-11
13
Medium Priority
?
165 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
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
LVL 51

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 51

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 51

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 69

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 69

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

762 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