Monday, March 12, 2012

I can not insert CURRENT_TIMESTAMP into column type timestamp

I can not insert CURRENT_TIMESTAMP into column type timestamp

I defined a data Table that has column type timestamp.

I did not achieve insert CURRENT_TIMESTAMP data into column typed timestamp.

My statement is below.What is wrong with it? Thanks

set@.cmdS2 ='Insert Into TABLOLAR Values('+CHAR(39) + @.TABLO +CHAR(39) +','+CHAR(39) + @.TABLO_ACIKLAMASI +CHAR(39) +','+CHAR(39) +CURRENT_TIMESTAMP+CHAR(39) +','+CHAR(39) + @.KLLNC +CHAR(39) +')'

Hello my friend,

This is a common misconception. The timestamp type is not a date field, it is a binary reference. When you update any field in the record, the value of the timestamp field changes. It has its uses. For example, if I take a copy of your data, work on it and then wish to update your data with my changes, the first thing I would do is check that your timestamp value is the same as the one I have (the same as when I took it). If it is, I know it is safe to update your record. If not, then someone has changed the record at your end since I took a copy of it to work on so I do not update it. In your example that requires dates, just use a DATETIME or a SMALLDATETIME field.

Kind regards

Scotty

No comments:

Post a Comment