dbTalk Databases Forums  

Importing CSV File

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Importing CSV File in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ripper
 
Posts: n/a

Default Importing CSV File - 12-12-2008 , 05:24 PM






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

Reply With Quote
  #2  
Old   
Peter Gibbons
 
Posts: n/a

Default Re: Importing CSV File - 12-12-2008 , 05:44 PM






Ripper wrote:
Quote:
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


Reply With Quote
  #3  
Old   
Peter Gibbons
 
Posts: n/a

Default Re: Importing CSV File - 12-12-2008 , 05:44 PM



Ripper wrote:
Quote:
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


Reply With Quote
  #4  
Old   
Peter Gibbons
 
Posts: n/a

Default Re: Importing CSV File - 12-12-2008 , 05:44 PM



Ripper wrote:
Quote:
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


Reply With Quote
  #5  
Old   
Peter Gibbons
 
Posts: n/a

Default Re: Importing CSV File - 12-12-2008 , 05:44 PM



Ripper wrote:
Quote:
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


Reply With Quote
  #6  
Old   
Peter Gibbons
 
Posts: n/a

Default Re: Importing CSV File - 12-12-2008 , 05:44 PM



Ripper wrote:
Quote:
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


Reply With Quote
  #7  
Old   
Peter Gibbons
 
Posts: n/a

Default Re: Importing CSV File - 12-12-2008 , 05:44 PM



Ripper wrote:
Quote:
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


Reply With Quote
  #8  
Old   
Peter Gibbons
 
Posts: n/a

Default Re: Importing CSV File - 12-12-2008 , 05:44 PM



Ripper wrote:
Quote:
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


Reply With Quote
  #9  
Old   
Peter Gibbons
 
Posts: n/a

Default Re: Importing CSV File - 12-12-2008 , 05:44 PM



Ripper wrote:
Quote:
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


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.