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

Import CSV File

 
   Database Help (Home) -> ODBC RSS
Next:  Generate Account Numbers with Text  
Author Message
Ripper

External


Since: Feb 05, 2008
Posts: 17



(Msg. 1) Posted: Fri Dec 12, 2008 1:27 pm
Post subject: Import CSV File
Archived from groups: microsoft>public>sqlserver>odbc (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 = '\t', 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: Import CSV File 
Back to top
Login to vote
george george

External


Since: Dec 14, 2008
Posts: 1



(Msg. 2) Posted: Sun Dec 14, 2008 4:25 am
Post subject: Re: Import CSV File [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

BULK INSERT lcs.imp_oper from 'd:\data\oper.txt'
WITH (CODEPAGE = 'RAW', FIELDTERMINATOR = '\t', FIRSTROW = 2, FORMATFILE
= 'd:\data\oper.fmt')


oper.fmt:

8.0
2
1 SQLCHAR 0 20 "\t" 1 czak SQL_Czech_CP1250_CI_AS
2 SQLCHAR 0 4 "\n\r" 2 porc SQL_Czech_CP1250_CI_AS


Ripper napsal(a):
> 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 = '\t', 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?
>
>

 >> Stay informed about: Import CSV File 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Import help - We recently purchased a new SQL 2005 server that I need to import a DB from another server. in order to connect to the "other" server I have to use a 3rd party thoroughbred odbc driver. On our old SQL2000 box to perform this task I would sel...

Data import revisited - I have posted on this previously but can't find my post. So my apologies for asking this again. We have a unix DB that I want to import into an SQL 2005 server. We have a 3rd party ODBC driver to do this but when I try to import a table from the DB I...

Import Oracle CLOB to SQL Server - I am trying to import an Oracle table with CLOB datatype. The ODBC and OLEDB drivers does not provide this functionality. Is there any way to import the CLOB data? Are there any ODBC drivers(preferably free) that can provide this functionality? Thank...

Invalid File DSN - Please help me. Recently I have been getting the following error more and more often: Microsoft OLE DB Provider for ODBC Drivers error '80004005' General error: Invalid file dsn 'C:\Program Files\Common Files\ODBC\Data Sources\"name of dsn" ...

Create DSN programmatically cannot set Port (VBA) - Hello, I have tried for the past three days to find all of the possible attributes for SQL Server ODBC, most specifically how to 'uncheck' the "Dynamically determine port" option and set the port number to 1435. Here is what I have so far,...
   Database Help (Home) -> ODBC 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 ]