Solved

ms sql 2005 error when importing data

Posted on 2008-06-19
4
864 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to count the amount of days from a date in the past 2 46
SQL Select * from 6 36
SQL Encryption question 2 50
Bubble user-defined Sql RAISERROR(...) to c# exception 14 147
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…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 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

26 Experts available now in Live!

Get 1:1 Help Now