Solved

How do I load data with sql loader with two date formats for one field?

Posted on 2008-11-01
2
590 Views
Last Modified: 2011-10-19
I am loading bar delmited data with sql loader.  Some of the files used the date format MM/DD/YYYY and others use YYYY-MM-DD HH24:MI:SS.  The control file with MM/DD/YYYY format is listed below.  FIELD3 is the one with different formats.  Is there a way to use one control file to load files with the two different date formats?

LOAD DATA
INFILE 'sample.dat'
APPEND
INTO TABLE TMP_TABLE
FIELDS TERMINATED BY '|'
(FIELD1,
FIELD2,
FIELD3 DATE "MM/DD/YYYY",
FIELD4,
FIELD5 DATE "YYYY-MM-DD HH24:MI:SS")
0
Comment
Question by:wayneb01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 32

Accepted Solution

by:
awking00 earned 250 total points
ID: 22857540
See attached.

format-dates.txt
0
 
LVL 32

Expert Comment

by:awking00
ID: 22857545
Sorry, the control file should read date_check(...) and not check_date(...).
0

Featured Post

Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help with Data Warehouse / Data Marts 4 42
Microsoft Access VBA - allocate a colour 3 73
Shared Service Environment 2 54
EF5: Update Model from Database not working 3 83
Read about achieving the basic levels of HRIS security in the workplace.
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
This video shows how to recover a database from a user managed backup
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question