July 1, 2014 at 7:30 pm
Hi, I'm hoping someone can help with a mystifying error.
I have run a query in sql server, saved the results as a .csv, then turned around and tried to import the .csv back into another database in sql server and create a table from it using the import wizard.
But when I do that, I get the error messages pictured in the attached jpeg.
I've tried going to Advanced in the Data Source dialogue box and changing the ACCOUNT_NM to OutputColumnWidth 70 or 90 or 255, with no luck.
Also going to Advanced in the Data Source dialogue box and changing the ACCOUNT_NM Data Type to DT_TEXT or DT_NTEXT, with no luck.
I've tried going to the Edit Mappings dialogue box and changing the the Destination Type for ACCOUNT_NM to NVARCHAR, VARCHAR, NVARCHAR(MAX), VARCHAR(MAX), and TEXT with still no luck.
I've attached a sample of the data to this email. There are some exotic characters in the ACCOUNT_NM field.
Greatly appreciate any help!
July 2, 2014 at 3:42 am
try using bulk insert:
BULK INSERT table_name
FROM 'the adress where your csv is'
WITH
(
FIELDTERMINATOR=';',
ROWTERMINATOR='/n'
)
July 2, 2014 at 11:35 am
Hi, thanks for getting back to me on this. I tried your suggestion and I got the errors below:
Errors:
Msg 4866, Level 16, State 1, Line 1
The bulk load failed. The column is too long in the data file for row 1, column 1. Verify that the field terminator and row terminator are specified correctly.
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".
the bulk insert query I tried to run is below:
BULK INSERT [JamesProject].[dbo].[outer_query_scot]
FROM 'D:\Documents\James Project\Main Table\outer_query_scot.csv'
WITH
(
FIELDTERMINATOR=';',
ROWTERMINATOR='/n'
July 3, 2014 at 2:15 am
Oh sorry..my mistake. In ROWTERMINATOR it is not =/n it is =\ n.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply