Solved

Strange SQL Update Issue

Posted on 2015-02-11
13
160 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 eBook: Backup on AWS

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

 
LVL 50

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 50

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 50

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

739 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