Solved

ms sql 2005 error when importing data

Posted on 2008-06-19
4
866 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Server 2012 express 24 42
CONVERT date time to a different time zone. 2 71
Following an example - removing duplicate strings 4 67
Addition to SQL for dynamic fields 6 56
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.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

735 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