My table source:
num_facture | TYPE | actif | date |
---|---|---|---|
1 | 1 | 1 | 2010-01-31 00:00:00.000 |
2 | 2 | 1 | 2011-01-31 00:00:00.000 |
3 | 3 | 2 | 2012-01-31 00:00:00.000 |
4 | 4 | 2 | 2013-01-31 00:00:00.000 |
The Column data types are:
Column | Data Type |
---|---|
TYPE | tinyint |
Actif | tinyint |
date | datetime |
I'm working with SSIS to load my destination table.
So, I want to change TYPE
for
Normal
if 1Divers
if 2Intra-Société
if 3Prospect
if 4
Also, to change actif
to:
no
if 1yes
if 2
Also, get the seniority from the date
So, I created a Derived Column transformation with 3 columns as follows:
Type Column
TYPE == 1 ? "Normal" : TYPE == 2 ? "Divers" : TYPE == 3 ? "Intra-Société" : TYPE == 4 ? "Prospect" : ""
Actif Column
actif == 1 ? "No" : actif == 2 ? "yes" : ""
Date Column
DATEDIFF("YY",date,GETDATE())
All of these transformations didn't work.
[OLE DB Destination [288]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "Invalid character value for cast specification". An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "Invalid character value for cast specification".
[OLE DB Destination [288]] Error: There was an error with OLE DB Destination.Inputs[OLE DB Destination Input].Columns[Derived Column actif] on OLE DB Destination.Inputs[OLE DB Destination Input]. The column status returned was: "The value could not be converted because of a potential loss of data.".