Date format to be loaded using sql loader - sql-loader

I have 03-JUN-2012 16:06:54 format. How do I do this using SQl loader.While using this in control file I used
Start date "dd-mmm-yy HH:MM:SS" but it is not working

you should use the following in the control file
start date "dd-mmm-yy hh24:mi:ss"

Related

MySQL 5.1.73 Change timestamp format for general_log file

I'm trying to change the format of the general log file generated by MySQL 5.1.73.
the actual timestamp format for "event_time is:
"210909 10:32:12 12 Connect user#localhost on database"
Is there a possibility for changing its timestamp format ?
I would like the format to follow the format: 2015-04-14 22:52:11 or even containing the timezone following the RFC 3339. "1937-01-01T12:00:27.87+00:2" (UTC)
I found a solution by adding the mysql-general.log file as inputFile in rsyslog. Applying a template allow me to rewrite the log with a correct timestamp format.
Thanks for your replies / comments

Time field (in the format '02:00:00 PM' ) not able to export from Excel to MySql

I am trying to export data from excel(which I downloaded form a different source) to MySql using 'MySql for Excel' plugin, but I am facing issue with the time field. The format of the time is out of my control. I've tried with both formats(General and Time) in Excel. Still seeing this issue. Is there workaround for this?
Export it as a string, not a TIME.
in LOAD DATA, import it as a VARCHAR() into an #variable
use str_to_date() to parse it into the TIME column.

Validate date column in CSV with Data Factory

I'm attempting to use Data Factory to import a CSV file from Azure File storage into SQL Azure. So far I'm using the copy data task to read the CSV and save into SQL Azure.
My CSV file contains 2 date columns with the date in the format dd/MM/yyyy. How can I set Data Factory to validate and read dates in this format?
You can follow my step, I tried this and Data Factory can validate and read dates in "dd/MM/yyyy" format.
This is my csv file, also has two columns with the date in the format "dd/MM/yyyy".
The difference between us is I import my file from Azure blob storage into my Azure SQL database by using Copy Data.
If you want Data Factory can validate and read dates in "dd/MM/yyyy" format, during File format settings, you must set the the schema, specify the column type and the format. Please see this picture:
After copy active completed, the date with "dd/MM/yyyy" format will be parsed to the default format "yyyy-MM-dd".
Hope this helps.

Convert a Unicode time in a CSV spreadsheet so I can import to MySQL date/time stamp

I'm stuck on this. I have a guestbook I'm converting from an old website into Wordpress comments. The guestbook has all the dates written in as unix. I already have the file transposed so I can import it into Wordpress comments and all works good, except the date field, which defaults to 0000-00-00 00:00:00.
I also have fields in standard Excel time formats but I need to find a way to conver that to the standard 0000-00-00 00:00:00.
Any ideas?
I actually figured this out after posting. Here was the issue. I had a CSV file from a previous guestbook that contained comments. In that CSV file the date / timestamp was in UNIX code (i.e. seconds since 1/1/1970).
In Excel, I found a formula to convert that to a date Excel can read. However, that date, when opened as a CSV, doesn't show in the correct format for MySQL. It uses the Excel date format, which is some string of numbers, I"m assuming similar to Unix time - from a certain date.
What I did was use the excel formula TEXT(Value, YYYY-MM-DD HH:MM:SS) to convert the excel date/time to a string in the correct format. Then the CSV file worked.

Syntax for MySQL LOAD XML "SET" parameter?

I am trying to load an xml file containing timestamp entries in the "20120924 22:12" format into MySql.
I am using the LOAD XML feature. Of course it's not working because MySQL is expecting "2012-09-24 22:12". If I was using LOAD FILE I would add
SET tmstmp = str_to_date(#var3, '%Y%m%d %h:i%')}
to my command, where the tmstmp data is in column 3 of the tile. So for XML I'd like to use
SET tmstmp = str_to_date(#tmstmp, '%Y%m%d %h:i%')}
where tmstmp is the tag containing my timestamp data. But this doesn't work. #tmstmp is empty. How do I access tags in SET statements under LOAD XML? The MySQL documentation just defers to the LOAD FILE documentation but it's not there of course. Thanks for any help.
The format is wrong (i% must be %i). So, change '%Y%m%d %h:i%' with '%Y%m%d %h:%i' and try to load data again.
Also %h should be %H because you use 24-hour format.