Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MaxDB - Everything about MaxDB, formerly known as SAP DB
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
MySQL++ - Programming with the C++ API to MySQL
ODBC - ODBC with the MySQL Connector/ODBC driver
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
mysql openssl Question
mysql:it 's a db not a dbms how it 's possible?!
Does the binary log enabling affect the MySQL performances?
Strange behavior, Table Level Permission
FULLTEXT query format question
Preventing Duplicate Entries
Comparing and writing out BLOBS
Executing MySQL Commands From Within C Program
Can 't access mysql after kernel upgrade
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Downgrade Mysql from 4 to 3 23
MySQL Cluster Software
mysql test 4 1 fails with the gis test
ERROR 2002: Can 't connect to local MySQL server through socket
Getting Identity after INSERT
Update one field with more fields from another table
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
mysql have same function mthod as Oracle decode()
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
Inserting DateTime values not working properly

Inserting DateTime values not working properly

2005-05-12       - By Chris Robinson

 Back
Reply:     1     2     3     4     5     6  

Hi all,

I'm having a strange problem with an Insert into a DateTime field in
MySQL.  I'm running v4.1.7 on Windows 2000 Server with Service pack 4.

Basically I'm running an insert query that inserts data into a couple of
DateTime fields (as well as some other fields).  The query is (with sample
data)

INSERT INTO u6_filec_maindata_tbl
(FileUID,MeterNumber,UnitNumber,UTFilename,FTFilename,
UTNumber,UTQMAX_REG,UTQMAX5_REG,UTQMAX_PLOSS,UTQMAX5_PLOSS,FinalTestHead
,PretestQMAX5_PLOSS,
QMAX_REG,QMAX5_REG,QMAX_PLOSS,QMAX5_PLOSS,UTDateTimeTested,FTDateTimeTested)
VALUES
(1,'G9B11111110505',123456,'ut909041533.txt','ft1001040703.txt',11,0.150000,0
.370000,10.800000,3.600000,
1242772,0.410000,-1.090000,-999.999000,1.150000,-999.999000,'20040909
153900','20040930 152200')

The query works fine & all the data inserts correctly.... except for the
values UTDateTimeTested ('20040909 153900') and FTDateTimeTested ('20040930
152200').  These fields are formatted as DateTime with default values of
"0000-00-00 00:00:00".  After the insert, these two fields do not contain
the data in the Insert query.  instead they contain the default value
"0000-00-00 00:00:00".

Now some background:  These Inserts are carried out over ODBC by a program
I've written in C that imports text files full of result data into the
database.  I've developed this program on Windows 2000 Professional, SP4
with the same MySQL version and ODBC driver.  On this machine, the DateTime
data inserts correctly without any problems at all.  I moved the program to
a Windows 2000 Server running SP4 (this is a fresh install, nothing else
was on the server).  On this I installed MySQL and ODBC (also installed the
Query Browser and Administrator).  I then copied the tables (the database
is MyISAM format) from the Windows 2000 Pro PC to the Windows 2000 Server
machine.  I then ran the program and found that all the records using the
DateTime had this problem.

What I've tried to resolve the issue:
- Checking the regional settings on the server and 2k pro machines - both
are the same.
- Manually running the Insert query in the MySQL query browser.  I get the
same result.  It leaves the default values when I run it on the server, but
inserts the correct data when I run it on my Win2k pro machine.
- Doing a repair on the table.

Any ideas?  I'm really stumped?

Thanks in advance,
Chris.


--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe:    http://lists.mysql.com/win32?unsub=mysql@(protected)


Earn $52 per hosting referral at Lunarpages.