Search code examples
sql-server-2008ssissql-import-wizard

SQL Import wizard unable to map tinyint


I have created a table named test2 as follows in SQL Server 2008 R2

id || userid || time

tinyint uniqueidentifier time(7)

I have created an .csv file for the same as follows that contains a single row

id || userid || time(7)

1 b64d51a8-852f-40ea-ab4c-080df747214b 00:00:00

Now, i m using SQL import wizard to insert this row into my database table.

On selecting the following mapping(See below) i get this error:

  Executing (Error)
  Messages
  Error 0xc02020a1: Data Flow Task 1: Data conversion failed. The data conversion for column  "Column 0" 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 1: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  
  The "output column "Column 0" (10)" failed because error code 0xC0209084 occurred, and the error row       disposition on "output column "Column 0" (10)" specifies failure on error. 
  An error occurred   on the specified object of the specified component.  There may be error messages posted before this with more information about the failure.
  (SQL Server Import and Export Wizard)

  Error 0xc0202092: Data Flow Task 1: An error occurred while processing file    
  "C:\Users\parth\Documents\test2.csv" on data row 1.
  (SQL Server Import and Export Wizard)

   Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  
   The PrimeOutput method on component "Source - test2_csv" (1) returned error code 0xC0202092.  
   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)

Mapping:

id(tinyint) - > SSIS single byte unsigned int

userid(uniqueidentifier) --> SSIS unique identifier

time(7) ---> SSIS database time with precision

can anyone tell me what I am doing wrong in this ? Is there any way to solve this error?

Thanks in advance


Solution

  • Use Single-byte Unsigned Integer as the source datatype to map into a tinyint destination. A tinyint uses 1 byte of storage and has values which range from 0 to 255, so it is unsigned.