Re: automatic timestamp
Scott, I do not think that is how it works under revision 4.0.21. Thanks, Néstor :-) On 7/5/06, Scott Haneda [EMAIL PROTECTED] wrote: People, I have the following table: DROP TABLE IF EXISTS bid; CREATE TABLE bid ( bid_id int(11) NOT NULL auto_increment, bid_proj_name varchar(100) NOT NULL default '', bid_prop_name varchar(100) NOT NULL default '', bid_amount varchar(20) NULL default '', bid_sub_name varchar(100) NOT NULL default '', bid_sub_desc varchar(100) default '', bid_sub_amount varchar(20) NULL default '', bid_winner tinyint(1) NOT NULL default '0', bid_date TIMESTAMP, PRIMARY KEY (bid_id), UNIQUE KEY proj_prop (bid_proj_name,bid_prop_name) ) TYPE=MyISAM; and I am trying toload a file with the following data: ,Construction Management,RCG Consulting,,Orly-Belle ,Construction Management,RCG Consulting,,American Engineers I am using phpmyadmin and the date always gets enter as 00 What do I need to do to force the current time stamp? I am using mysql version 4.0.21-standard IIRC, you need two timestamp fields for auto to work, default timestamps for the first timestamp column will be ignored, but the first column will get auto timestamp in a table that has more than one timestamp column. I usually set up two, updated and added, and I always set the added field to NOW() It explains it pretty well in the docs here http://dev.mysql.com/doc/refman/4.1/en/timestamp-4-1.html -- - Scott HanedaTel: 415.898.2602 http://www.newgeo.com Novato, CA U.S.A. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: automatic timestamp
Chris, my situation is that I am reading a file using phpmyadmin and whne I do not add the extra , then I get an invalid number of records, so I have to have the extra , When I do an insert without the last comma, it does set the correct day. I do not know that it will work if I add the fields that I am importing via phpmyadmin I guess I will just do it that way. When I am importing a file just add the field names that I am bringing in. Thanks to all, Néstor :-) On 7/5/06, Chris [EMAIL PROTECTED] wrote: Nestor wrote: People, I have the following table: DROP TABLE IF EXISTS bid; CREATE TABLE bid ( bid_id int(11) NOT NULL auto_increment, bid_proj_name varchar(100) NOT NULL default '', bid_prop_name varchar(100) NOT NULL default '', bid_amount varchar(20) NULL default '', bid_sub_name varchar(100) NOT NULL default '', bid_sub_desc varchar(100) default '', bid_sub_amount varchar(20) NULL default '', bid_winner tinyint(1) NOT NULL default '0', bid_date TIMESTAMP, PRIMARY KEY (bid_id), UNIQUE KEY proj_prop (bid_proj_name,bid_prop_name) ) TYPE=MyISAM; and I am trying toload a file with the following data: ,Construction Management,RCG Consulting,,Orly-Belle ,Construction Management,RCG Consulting,,American Engineers I am using phpmyadmin and the date always gets enter as 00 What do I need to do to force the current time stamp? I am using mysql version 4.0.21-standard Don't specify the bid_date as an empty string - ie take the last , from the end. The empty string is being converted to '00' because it's an invalid date. If you don't specify that column, it will default to 'now()'. mysql insert into bid(bid_proj_name) values ('test'); Query OK, 1 row affected (0.00 sec) mysql insert into bid(bid_proj_name, bid_date) values ('test 2', ''); Query OK, 1 row affected (0.01 sec) mysql select bid_id, bid_proj_name, bid_date from bid; ++---++ | bid_id | bid_proj_name | bid_date | ++---++ | 1 | test | 20060706110203 | | 2 | test 2| 00 | ++---++ 2 rows in set (0.00 sec) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: automatic timestamp
People, I have the following table: DROP TABLE IF EXISTS bid; CREATE TABLE bid ( bid_id int(11) NOT NULL auto_increment, bid_proj_name varchar(100) NOT NULL default '', bid_prop_name varchar(100) NOT NULL default '', bid_amount varchar(20) NULL default '', bid_sub_name varchar(100) NOT NULL default '', bid_sub_desc varchar(100) default '', bid_sub_amount varchar(20) NULL default '', bid_winner tinyint(1) NOT NULL default '0', bid_date TIMESTAMP, PRIMARY KEY (bid_id), UNIQUE KEY proj_prop (bid_proj_name,bid_prop_name) ) TYPE=MyISAM; and I am trying toload a file with the following data: ,Construction Management,RCG Consulting,,Orly-Belle ,Construction Management,RCG Consulting,,American Engineers I am using phpmyadmin and the date always gets enter as 00 What do I need to do to force the current time stamp? I am using mysql version 4.0.21-standard IIRC, you need two timestamp fields for auto to work, default timestamps for the first timestamp column will be ignored, but the first column will get auto timestamp in a table that has more than one timestamp column. I usually set up two, updated and added, and I always set the added field to NOW() It explains it pretty well in the docs here http://dev.mysql.com/doc/refman/4.1/en/timestamp-4-1.html -- - Scott HanedaTel: 415.898.2602 http://www.newgeo.com Novato, CA U.S.A. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: automatic timestamp
Nestor wrote: People, I have the following table: DROP TABLE IF EXISTS bid; CREATE TABLE bid ( bid_id int(11) NOT NULL auto_increment, bid_proj_name varchar(100) NOT NULL default '', bid_prop_name varchar(100) NOT NULL default '', bid_amount varchar(20) NULL default '', bid_sub_name varchar(100) NOT NULL default '', bid_sub_desc varchar(100) default '', bid_sub_amount varchar(20) NULL default '', bid_winner tinyint(1) NOT NULL default '0', bid_date TIMESTAMP, PRIMARY KEY (bid_id), UNIQUE KEY proj_prop (bid_proj_name,bid_prop_name) ) TYPE=MyISAM; and I am trying toload a file with the following data: ,Construction Management,RCG Consulting,,Orly-Belle ,Construction Management,RCG Consulting,,American Engineers I am using phpmyadmin and the date always gets enter as 00 What do I need to do to force the current time stamp? I am using mysql version 4.0.21-standard Don't specify the bid_date as an empty string - ie take the last , from the end. The empty string is being converted to '00' because it's an invalid date. If you don't specify that column, it will default to 'now()'. mysql insert into bid(bid_proj_name) values ('test'); Query OK, 1 row affected (0.00 sec) mysql insert into bid(bid_proj_name, bid_date) values ('test 2', ''); Query OK, 1 row affected (0.01 sec) mysql select bid_id, bid_proj_name, bid_date from bid; ++---++ | bid_id | bid_proj_name | bid_date | ++---++ | 1 | test | 20060706110203 | | 2 | test 2| 00 | ++---++ 2 rows in set (0.00 sec) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]