Solved

Strange SQL Update Issue

Posted on 2015-02-11
13
159 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 48

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 48

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
Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

 
LVL 49

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 49

Expert Comment

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

Assisted Solution

by:Nakul Vachhrajani
Nakul Vachhrajani earned 166 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 49

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 167 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 167 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 eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

Suggested Solutions

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…
I have a large data set and a SSIS package. How can I load this file in multi threading?
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

761 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