Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 DATA LOAD INFILE when loading large .csv Issue

Author  Topic 

josh.cusano
Starting Member

1 Post

Posted - 2012-07-30 : 18:32:46
Hey!

I'm a new SQL user. I recently created a database using MySQL to import a daily .csv flat file to do some data modeling. The files are large - 50 - 75Mb, with 300,000 to 500,000 rows of data.

I've been trying to use the DATA LOAD INFILE script but issues occur after a few thousand lines. Many of the table columns have different data types - VARCHAR, INT, DECIMAL, DATE. I'm assuming the data is not being properly delimited or the lines are not terminating properly because after a few thousand lines or more I get an error saying that a field (again, thousands of lines down) is being populated by the wrong data type. I do not have this issue with small files (usually less tha 1,00 rows).

Script used -
LOAD DATA INFILE '/test2.csv' INTO TABLE logdb FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (field1, field2, ...);

I've tried this with '\r' and '\r\n' too.

Any help is appreciated!

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-07-30 : 18:37:29
You'll want to post your question on a site that specializes in MySql. SQLTeam.com is for Microsoft SQL Server. In MSSQL, we'd use bcp.exe, BULK INSERT command or various other import methods. We don't have a LOAD DATA command.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -