TankTop
TankTop

Reputation: 1

Cannot insert the value NULL into column -ADF Pipeline failure

While running Copy Activity in a pipeline of Azure Data Factory, i'm getting below pipeline error.

*The RowID is to count rows in the Database which should not take any NULL value in the column. The source XML file does not have any RowID Column.

Copy Activity is connected to Two Source and Sink datasets, and both of them are connected to Stage Database and Master Database. And they both have RowID Schema.


Failure happened on 'Sink' side. ErrorCode=SqlOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=A database operation failed. Please search error to get more details.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Data.SqlClient.SqlException,Message=Cannot insert the value NULL into column 'RowID', table 'MyDB.dbo.MyData'; column does not allow nulls. INSERT fails. The statement has been terminated.,Source=.Net SqlClient Data Provider,SqlErrorNumber=515,Class=16,ErrorCode=-2146232060,State=2,Errors=[{Class=16,Number=515,State=2,Message=Cannot insert the value NULL into column 'RowID', table 'MyDB.dbo.MyData'; column does not allow nulls. INSERT fails.,},{Class=0,Number=3621,State=0,Message=The statement has been terminated.,},],'


Cannot figure out in which pipeline it is trying to INSERT a NULL value to Stage and Master Database.

Upvotes: 0

Views: 112

Answers (1)

Pratik Lad
Pratik Lad

Reputation: 8382

Cannot insert the value NULL into column 'RowID', table 'MyDB.dbo.MyData'; column does not allow nulls. INSERT fails. The statement has been terminated

As per the error you're encountering it shows that in your sink database (where copy activity storing the data) has a RowID column defined as NOT NULL, but the data being inserted into it does not provide a value for RowID. Since RowID is mandatory as per your destination schema, the insert operation fails.

As your destination database can't take null values and source does not have RowId column, you need to generate the column. for this you can use Data Flow activity to create RowId column and copy the data to destination database.

In data flow using Surrogate key transformation You can create RowId column as below: enter image description here

Data Preview for this is as below: enter image description here

Upvotes: 1

Related Questions