Solved

ms sql 2005 error when importing data

Posted on 2008-06-19
4
863 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
Comment Utility
0
 
LVL 51

Accepted Solution

by:
Mark Wills earned 200 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

743 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

15 Experts available now in Live!

Get 1:1 Help Now