Importing csv file to table

0

I'm trying to import a csv file to a table in sql server 2005 with the wizard. but when i import the file is always give me this errors :

Executing (Error) Messages Error 0xc02020a1: Data Flow Task 1: Data conversion failed. The data conversion for column "Column 15" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.". (SQL Server Import and Export Wizard)

Error 0xc020902a: Data Flow Task 1: The "output column "Column 15" (70)" failed because truncation occurred, and the truncation row disposition on "output column "Column 15" (70)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component. (SQL Server Import and Export Wizard)

Error 0xc0202092: Data Flow Task 1: An error occurred while processing file "C:\PEP_ENTITIES_71.csv" on data row 1. (SQL Server Import and Export Wizard)

Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "Source - PEP_ENTITIES_71_csv" (1) returned error code 0xC0202092. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure. (SQL Server Import and Export Wizard)

What i'm doing wrong? This file was a export from a query, then i delete all records and try to import.

sql
sql-server
sql-server-2005
csv
asked on Stack Overflow Jan 9, 2013 by Luis

2 Answers

3

The flat file import task will default lengths to VARCHAR(50). You need to go to the Advanced property of the flat file connection page and change the length manually to match the destination table. There should also be an option to Suggest Types which may match the metadata that you're using, but it does a sampling of rows from the file so it may not be as accurate as just setting types manually.

answered on Stack Overflow Jan 9, 2013 by Jeremiah Peschka
0

It may be that you're trying to import data from the CSV which is too large for the field you're importing it in to. Perhaps you need to increase the size of your fields in your SQL table?

Have you tried to import a single, very small line of data from the CSV to see if that works? If it does, excessively large data somewhere in the rest of the sheet may be the problem.

answered on Stack Overflow Jan 9, 2013 by (unknown user)

User contributions licensed under CC BY-SA 3.0