0
setting timestamp
New Here
,
/t5/coldfusion-discussions/setting-timestamp/td-p/829793
Mar 07, 2009
Mar 07, 2009
Copy link to clipboard
Copied
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
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/setting-timestamp/m-p/829794#M76661
Mar 07, 2009
Mar 07, 2009
Copy link to clipboard
Copied
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.
Also, for the current date and time, you could use ms sql's getdate() function.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
LATEST
/t5/coldfusion-discussions/setting-timestamp/m-p/829795#M76662
Mar 07, 2009
Mar 07, 2009
Copy link to clipboard
Copied
> [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
> 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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

