Solved

ms sql 2005 error when importing data

Posted on 2008-06-19
4
865 Views
Last Modified: 2012-08-13
I am using the import manager from ms sql 2005
I am importing from a tab delimited flat table
I set colums with legnth to fit all data (just characters)
I start the process and get this error:

Information 0x402090de: Data Flow Task: The total number of data rows processed for file "I:\consultores\BASES DE DATOS\faltantab.txt" is 35.
 (SQL Server Import and Export Wizard)
 
Error 0xc02020c5: Data Flow Task: Data conversion failed while converting column "Nombre" (10) to column "Nombre" (63).  The conversion returned status value 2 and status text "The value could not be converted because of a potential loss of data.".
 (SQL Server Import and Export Wizard)
 
Error 0xc0209029: Data Flow Task: The "output column "Nombre" (63)" failed because error code 0xC020907F occurred, and the error row disposition on "output column "Nombre" (63)" specifies failure on error. An error occurred on the specified object of the specified component.
 (SQL Server Import and Export Wizard)
0
Comment
Question by:robrodp
  • 2
4 Comments
 
LVL 31

Assisted Solution

by:James Murrell
James Murrell earned 100 total points
ID: 21826034
0
 
LVL 51

Accepted Solution

by:
Mark Wills earned 200 total points
ID: 21826116
Need to increase the database column to match the size.

Normally, do the import into a staging table - which is fairly open structure, large column sizes, maybe even varchars rather than numbers. The import will work a bit easier, then validate / verify the contents before updating the real table...

Could also use openrowset or bulk import with a format file as a ExecuteSQL task (in SSIS) or as a script that could be scheduled...

0
 
LVL 5

Assisted Solution

by:fesnyng
fesnyng earned 200 total points
ID: 21828152
When I import a flat file, it seems that I miss the same thing each time AND I get the error that you are getting.   The steps for me to get that error message are;

Right click on the database, select Tasks and Import Data ...
The Choose Data Source screen shows
Change the Data Source to Flat File Source
Browse to select the file to import
Select Columns to view the data -- all looks good
Hit NEXT ...   **** this is my error

BEFORE going any further, select Advanced (right below columns)
If you are importing character data, then SSIS has mos likely selected DT_STR for Data Type
AND has set 50 as the default for OutputColumnWidth.  IF the column data is greater than 50 characters (as my often is), then SSIS provides  the ugly error that you posted above.

To recap:  on the Choose a Data Source screen, select Advanced and be sure that the OutputColumnWidth is large enough to handle the data in the column.  






0
 
LVL 51

Expert Comment

by:Mark Wills
ID: 21828406
Yes, that's right and and is a right pain that a flat file will default to 50, and then (if no table) defaults to nvarchar 50. The error resolution is very subtle as to which one is the offending column often resulting in resetting both - and if some mapping has happened, also means remove the table (or entries) and starting again... That is part of the reasoning behind the staging table - it is sooo much easier to manage the database space...

Of course you do not have to use the wizard, there are other more robust ways of handling it - but only if you are good with coded solutions, otherwise the wizard is a right pain in the proverbial, but very easy to use. Pro's and Con's. At the end of the day, you do end up with a robust solution either way, so long as there are no changes, and, if you were to sit down and plan the project to it's fullest extent then you would probably have the import layout document sitting beside you when defining the import file definition. Reality, we all tend to dive in, and then find out about the 50 characters after wards...

Cheers,

0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now