Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Importing CSV File

 
   Database Help (Home) -> DTS RSS
Next:  Need a S/W development company for a project  
Author Message
Ripper

External


Since: Feb 05, 2008
Posts: 17



(Msg. 1) Posted: Fri Dec 12, 2008 2:24 pm
Post subject: Importing CSV File
Archived from groups: microsoft>public>sqlserver>dts (more info?)

I am attempting to import a CSV file using the Bulk Insert sql command...

USE datasheets
BULK INSERT tblgrades
FROM '\\PHS-CI-TEST\c$\book1tab.txt'
WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n\r')
GO

The command goes, but then I hit an error.
Msg 4864, Level 16, State 1, Line 1
Bulk insert data conversion error (type mismatch) for row 1, column 2 (LocID).

The first column is the primary key. the second column, the first one in my
csv file, is a 6 digit number. On the table it is set to int. I can't
figure out why I am getting the error when the CSV is a number and the second
column, the first after the primary key, is set to int.

Anyone have any ideas?

--
Thanks As Always
Rip

 >> Stay informed about: Importing CSV File 
Back to top
Login to vote
Peter Gibbons

External


Since: Aug 19, 2008
Posts: 23



(Msg. 2) Posted: Fri Dec 12, 2008 6:25 pm
Post subject: Re: Importing CSV File [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Ripper wrote:
> I am attempting to import a CSV file using the Bulk Insert sql command...
>
> USE datasheets
> BULK INSERT tblgrades
> FROM '\\PHS-CI-TEST\c$\book1tab.txt'
> WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n\r')
> GO
>
> The command goes, but then I hit an error.
> Msg 4864, Level 16, State 1, Line 1
> Bulk insert data conversion error (type mismatch) for row 1, column 2 (LocID).
>
> The first column is the primary key. the second column, the first one in my
> csv file, is a 6 digit number. On the table it is set to int. I can't
> figure out why I am getting the error when the CSV is a number and the second
> column, the first after the primary key, is set to int.
>
> Anyone have any ideas?
>
Are you sure that the ROWTERMINATOR should not be \r\n?

Regards,

Peter

 >> Stay informed about: Importing CSV File 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Importing Query From .sql file? - Hi can u tell me how to fetch query from .sql file while working in DTS 2000? actually, I need to fetch query from . sql file(on local drive) and then want to execute this query on a sql database to export that sql data to a ..txt file using dts..

importing unstructured data - All I am currently working on a way of importing some excel spreadsheets into MS SQL. Although the spreadsheets are structured visually, they are not very import friendly as there are several tables worth of information below each other on a given..

Lost data importing from Excel - I'm trying to import a small spreadsheet from Excel into a pre-created SQL Server table. One column is defined as char(2), and the data values are actually 2 digits. When the leading digit is non-zero, the data transfers OK, but if the code is, say, '06'...

Error when importing data from Orcale DB to SQL Server DB - Hi, I am trying to importing data to my SQL Server DB using DTS but I am getting errors. I don't have control over Orcale and looks like the errors occur on DataTime fields. Here is the error message: "Error at Destination for Row number 103299, ...

Importing Fixed Width Files with Multiple Occurrences - Hello, can someone please tell me how to set up flat file connection object when the format of the file is as follows: Date Record(s) - Fixed Format Assumed Decimal Starting Field Name ...
   Database Help (Home) -> DTS All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]