I'm new to SSIS Package. I want to transfer data from source to destination database which has different table structures. My Data Flow is from OLE DB Source to OLE DB Destination
I have named OLE DB Source as Patient Source and in OLE DB Source Editor, the connection is made with Source Database and in Data Access Mode I have selected SQL command and SQL command text as follows
select ppFName, ppLName, ppPersonalNbr, ppEmailOne from pat_Patients
and as well as I have previewed the data, it shows 75 rows.
I want to transfer these four fields from this database to my source database table named Person and its table structure as above.
The connection is made in OLE DB Destination Editor,
and the mappings as follows,
When I run the project, my data flow is as follows,
and I got three errors, in which first error states
[OLE DB Destination [2]] 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: "The statement has been terminated.".
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "Cannot insert the value NULL into column 'TenantId', table 'test_9.dbo.Person'; column does not allow nulls. INSERT fails.".
I know that TenantId and PersonId are both not null and 'foreign key' & 'primary key identity' respectively.
But I want to enter TenantId as '1' and PersonId as Identity i.e., auto-increment for all 75 rows from Patient Source. As well as I want to enter AddedBy as '1' and AddedDateTime to system current datetime.
I don't know how to achieve the above requirements, please anyone help me.
Thanks in advance.
You can use
derived transformation
to assign 1 when theTenantId
is nullSimilary for
AddedBy
column add an expression as1
and forAddedDateTime
column asGETDATE()