Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

setting timestamp

New Here ,
Mar 07, 2009 Mar 07, 2009
Hi
In my MSSQL server I have a table column called timestamp of type timestamp.
In my Coldfusion file, I set a parameter called 'timestamp' = Now(), and cfsqltype="CF_SQL_TIMESTAMP" . However, when I tried a database query to insert 'timestamp' into SQL, it resulted in the following error msg:

[Macromedia][SQLServer JDBC Driver][SQLServer]Cannot insert an explicit value into a timestamp column. Use INSERT with a column list to exclude the timestamp column, or insert a DEFAULT into the timestamp column.

Should I be doing something differently? I tried setting type to string etc but nothing is working for me and I have spent hours on this.
Thanks
TOPICS
Database access
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 07, 2009 Mar 07, 2009
There was a recent thread on this topic. The problem could be that an MS Sql timestamp field might not be what you think it is. A better datatype choice would be date, which has a time component.

Also, for the current date and time, you could use ms sql's getdate() function.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 07, 2009 Mar 07, 2009
LATEST
> [Macromedia][SQLServer JDBC Driver][SQLServer]Cannot insert an explicit value
> into a timestamp column. Use INSERT with a column list to exclude the timestamp
> column, or insert a DEFAULT into the timestamp column.
>
> Should I be doing something differently? I tried setting type to string etc
> but nothing is working for me and I have spent hours on this.
> Thanks

The error message is very clear as to what the problem is and what the
solution is.

Timestamp columns can't take values in an insert statement, the DB
populates them automatically.

I found this out by googling your error message, and the very first match
explains it.

http://tinyurl.com/d8blyc
< http://www.google.com/search?hl=en&safe=off&q=Cannot+insert+an+explicit+value+into+a+timestamp+colum...

As does the second match, now that I look at it.

A good rule of thumb is that the first thing you should do if you get
stumped by an error (if just reading the error message doesn't explain it
;-), is to google the error message. I find that generally the answers
within the first two pages of results, quite often the first result!


--
Adam
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources