• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 218
  • Last Modified:

How to avoid a syntax error on this UPDATE statement..??

I'm running the following SQL statement and I'm getting a syntax error...

UPDATE Global_Response_Fields SET Timestamp='2011-10-22T08:50:34Z', CorrelationID='f1833aed8eeef'

If I remove the Timestamp value from the update then it works fine, but I'm not sure what about that value is causing me a problem or how to fix it..??  It's just a regular text field that I'm trying to add that string of text into.

Any information on how I can fix this would be greatly appreciated.  Thanks!
0
Andrew Angell
Asked:
Andrew Angell
  • 3
  • 2
  • 2
  • +1
1 Solution
 
Gerwin Jansen, EE MVETopic Advisor Commented:
I don't see a table in your update statement?

What do you get when you do:
select Global_Response_Fields, Timestamp from <tablename> where CorrelationID='f1833aed8eeef'

Open in new window

0
 
Andrew AngellAuthor Commented:
It's not a SELECT statement, it's an UPDATE statement.  The table name is Global_Response_Fields
0
 
Umar Topia.Net Full Stack DeveloperCommented:
UPDATE Global_Response_Fields SET Timestamp=now() , CorrelationID='f1833aed8eeef'
0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 
Umar Topia.Net Full Stack DeveloperCommented:
Actually you do not even need to update the timestamp...

It will be updated automatically

UPDATE Global_Response_Fields SET CorrelationID='f1833aed8eeef'
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
What do you want to update then? Only the CorrelationID field for all records in the table? How is your Timestamp field defined?

0
 
G_HCommented:
umartopia is correct. If the field has a "type" of Timestamp" then it should change when you update the other field.

Another thought for you...

I think "Timestamp" is a reserved word, so you should name it something else...

GH
0
 
Andrew AngellAuthor Commented:
The value is a string that comes back from the web service I'm working with.  I can't just use a local timestamp.  I need it to match what the service actually gives me for logging purposes.

I can try changing the name to see if the field name itself is causing the issue.  I'll give that a shot and come back to update in a bit.
0
 
Andrew AngellAuthor Commented:
It was indeed the use of a field called Timestamp that was causing my problem.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now