0

I've a question, when I use a sql command to set up a LOAD DATA LOCAL INFILE query in C#, I need to format the date (from 11/11/2000 to 2000/11/11). So I need a "@" to fix the format:

LOAD DATA LOCAL INFILE 'test_123.csv'
INTO TABLE test_123
FIELDS TERMINATED BY ','
IGNORE 1 LINES

(@Date, column1, column2, ...)
SET date = str_to_date(@Date, '%m/%d/%Y')

When I execute the query in MySQL administrator, it works fine. When I declare this in c#, he gives a fatal error exception because the "@" is used to declare a sql parameter (The error says: "You need to define the @Date parameter"). I think this is a tricky one, can you help me with this problem?

Thanks in advance! Thijs

1
  • Are you using System.Data.OleDb.OleDbCommand or something else? Commented Dec 8, 2010 at 12:34

1 Answer 1

0

I found no solution for this problem, I tried enough (I certainly tried not all of the options). My solution now is rather slow and ugly, first I loop trough the CSV and format the dates correctly, than I execute the query, but this solution totally misses the point of the load data infile.

If somebody knows a solution for this problem, feel free to post ;)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.