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
 SQL Server 2012 Forums
 Transact-SQL (2012)
 SQL bulk upload with date format from .csv file

Author  Topic 

calvinkwoo3000
Yak Posting Veteran

98 Posts

Posted - 2013-08-19 : 05:54:52
[quote][BULK
INSERT Table1
FROM 'D:\Table1Data.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO/quote]
I try to bulk data from a csv file.

I get below error message:

Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 87 (xxxColumnNamexxx).

The column contain date data (2009/04/03).
I believe it is data format issue to database cannot accept.

May i know how should i upload this data with the right date format.
I prefer not .xml file because the csv file have about 90 column which i need to define all the 90 column and i have about 40 csv file have to bulk upload.

Is there any easier way?

Thank you.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-08-19 : 06:39:06
You've to either user format file or make sure dates have consistent unambiguos format
ALternatively you can use Export Import task/SSIS where you can add logic to cast values to datetime before you transfer it to table

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -