views:

2018

answers:

2

Long story short, I'm taking a bunch of excel documents one by one, and importing them using the Import/Export wizard into a database in SQL Server 2005.

Here's one report (all processes not shown are a "Success"). Is there any way for me to ignore truncation errors? I've googled around to no avail, or at least not in my version.

- Executing (Success)

- Copying to [Datadev].[dbo].[Sheet0$] (Error)
  Messages
  * Error 0xc020901c: Data Flow Task: There was an error with output

column "Value Meaning Description" (234) on output "Excel Source Output" (9). The column status returned was: "Text was truncated or one or more characters had no match in the target code page.". (SQL Server Import and Export Wizard)

  * Error 0xc020902a: Data Flow Task: The "output column "Value

Meaning Description" (234)" failed because truncation occurred, and the truncation row disposition on "output column "Value Meaning Description" (234)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component. (SQL Server Import and Export Wizard)

  * Error 0xc0047038: Data Flow Task: SSIS Error Code

DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on component "Source - Sheet0$" (1) returned error code 0xC020902A. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure. (SQL Server Import and Export Wizard)

  * Error 0xc0047021: Data Flow Task: SSIS Error Code

DTS_E_THREADFAILED. Thread "SourceThread0" has exited with error code 0xC0047038. There may be error messages posted before this with more information on why the thread has exited. (SQL Server Import and Export Wizard)

  * Error 0xc0047039: Data Flow Task: SSIS Error Code

DTS_E_THREADCANCELLED. Thread "WorkThread0" received a shutdown signal and is terminating. The user requested a shutdown, or an error in another thread is causing the pipeline to shutdown. There may be error messages posted before this with more information on why the thread was cancelled. (SQL Server Import and Export Wizard)

  * Error 0xc0047021: Data Flow Task: SSIS Error Code

DTS_E_THREADFAILED. Thread "WorkThread0" has exited with error code 0xC0047039. There may be error messages posted before this with more information on why the thread has exited. (SQL Server Import and Export Wizard)

- Post-execute (Success)
  Messages
  * Information 0x402090df: Data Flow Task: The final commit for the

data insertion has started. (SQL Server Import and Export Wizard)

  * Information 0x402090e0: Data Flow Task: The final commit for the

data insertion has ended. (SQL Server Import and Export Wizard)

- Cleanup (Success)
  Messages
  * Information 0x4004300b: Data Flow Task: "component "Destination -

Sheet0$" (323)" wrote 210 rows. (SQL Server Import and Export Wizard)

+2  A: 

Why do you want to ignore errors? Why not find them and fix them?

At any rate, if you need to do more than the wizard provides, then you should use SSIS (SQL Server Integration Services) directly. That's what the wizard is using, only it can't assume that errors are ok.

It's very simple to write an SSIS package to loop over your Excel files and import them one at a time. The import data flow can be configured either to ignore errors, or to do something else with them, like report them.

John Saunders
This is a small task I'm doing with literally thousands of columns total. It's somewhat illogical (in my situation) to fix each one by hand. Thanks for the SSIS info.
scrot
How logical it is would depend on how often the problem occurred and what is causing it. For instance, if you look closely at those error messages, you'll see this is truncation _or_ incorrect code page. The former may be just a matter of using a wider column; the latter may be a question of a few non-ASCII characters.
John Saunders
+1  A: 

The wizard uses a smaller value as the standard varchar size for Excel data than you got in the wizard in SQL Server 2000. As a result it often truncates data that you are trying to do a quick import to a staging table on. However, when you do the wizard, one screen will ask you if you want to edit mappings and you can fix the size of the fields there. Or you can usea create table stament first to create a work table with the sizes you want (nvarchar(max) is good if you are looking at the data for the first time and have no idea how big the fields will be) and then import into it. With Excel, I know I have also had issues with SQl Server using only a few rows to determine datatype and then the insert failing for records (say for something like partnumber) because it thought based on the first few records it was an integer when it was really a sting type of data. You also could be having an issue like this, so it is a good idea to review the mappings anyway even if you don;tget truncation errors.

HLGEM