Questions tagged [mysql-error-1293]

Error 1293: There can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

Error 1293: There can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause.

9 questions
188
votes
9 answers

Why there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT clause?

Why there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause? CREATE TABLE `foo` ( `ProductID` INT(10) UNSIGNED NOT NULL, `AddedDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `UpdatedDate` TIMESTAMP NOT…
ripper234
  • 222,824
  • 274
  • 634
  • 905
133
votes
12 answers

Having both a Created and Last Updated timestamp columns in MySQL 4.0

I have the following table schema; CREATE TABLE `db1`.`sms_queue` ( `Id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `Message` VARCHAR(160) NOT NULL DEFAULT 'Unknown Message Error', `CurrentState` VARCHAR(10) NOT NULL DEFAULT 'None', `Phone`…
Xenph Yan
  • 83,019
  • 16
  • 48
  • 55
75
votes
8 answers

MySQL CURRENT_TIMESTAMP on create and on update

I want to define table which will have 2 TIMESTAMP fields, someting like this: CREATE TABLE `msgs` ( `id` INT PRIMARY KEY AUTO_INCREMENT, `msg` VARCHAR(256), `ts_create` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `ts_update` TIMESTAMP…
kuba
  • 3,670
  • 3
  • 31
  • 41
13
votes
2 answers

Why won't MySQL let me remove attribute "on update CURRENT_TIMESTAMP"?

I have a table with two timestamp fields. I simply defined them with a name and the type TIMESTAMP, yet for some reason MySQL automatically set one of them with a default value and the attribute on update CURRENT_TIMESTAMP. I was planning on having…
Hubro
  • 56,214
  • 69
  • 228
  • 381
7
votes
2 answers

Timestamp for row creation and last modification

I need to keep track of the time a row was inserted into the database, and the time it was last modified. I tried to create two separate columns, and use CURRENT_TIMESTAMP: create table def ( id int, creation timestamp default…
Matt Fenwick
  • 48,199
  • 22
  • 128
  • 192
4
votes
1 answer

How to get SQL to update my record Modified Timestamp correctly?

I am trying to set up an sql table which records when an account was created and when it was last modified. I would like sql to handle this so I don't have to do it in my php files. I have two columns in my users table (both are of type…
user1220022
  • 11,167
  • 19
  • 41
  • 57
0
votes
2 answers

INSERT works in SQLite but not MySQL

This table I created in a SQLite database: CREATE TABLE [tickets] ( [id] INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, [coupon_id] INTEGER NULL, [size] FLOAT NULL, [phone] VARCHAR(10) NULL, [date] DATE DEFAULT CURRENT_DATE NULL, [time] TIME…
John
  • 329
  • 1
  • 4
  • 18
0
votes
1 answer

MySQL dual datestamp for modified, and updated does not work

I am trying the following SQL statement: create table sample ( id int not null primary key auto_increment, name varchar(100), date_modified timestamp not null default current_timestamp on update current_timestamp, date_created timestamp not null…
kkr16
  • 3
  • 1
0
votes
1 answer

Proper workaround - there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

I have this table: CREATE TABLE IF NOT EXISTS news ( id int(11) NOT NULL AUTO_INCREMENT, data text, date_published timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, date_edited timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY…
sdfgg45
  • 1,232
  • 4
  • 22
  • 42