SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 SQL bulk upload with date format from .csv file
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

calvinkwoo3000
Yak Posting Veteran

Singapore
95 Posts

Posted - 08/19/2013 :  05:54:52  Show Profile  Reply with Quote
[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

India
52249 Posts

Posted - 08/19/2013 :  06:39:06  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000