Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ms sql 2005 error when importing data

Posted on 2008-06-19
4
Medium Priority
?
872 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 400 total points
ID: 21826034
0
 
LVL 51

Accepted Solution

by:
Mark Wills earned 800 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 800 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
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.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

688 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