manish singh wrote:
> that would make sense when iam trying to put data
> in
> 12/12/2004 format
>
> but iam not doing so
> the insert statement looks like this
>
> insert into mysql.table1 values( 11111,
> 2004-12-12, 2323);
>
> here the date is in mysql format.
> still it shows 0000-00-00
Same reason as before, that the SQL expression is numeric, and when it goes into a date field, it goes to 0000. You need to quote it so its not a numeric expression.
mysql> create table date_test (dt date);
Query OK, 0 rows affected (0.10 sec)
mysql> insert into date_test values (2004-12-12);
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> insert into date_test values(1980);
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> select * from date_test;
+------------+
| dt |
+------------+
| 0000-00-00 |
| 0000-00-00 |
+------------+
2 rows in set (0.00 sec)
mysql> select 2004-12-12;
+------------+
| 2004-12-12 |
+------------+
| 1980 |
+------------+
1 row in set (0.00 sec)
Regards,
Josh
Josh Chamas
Director, Professional Services
MySQL Inc., www.mysql.com
Get More with MySQL!
http://www.mysql.com/consulting