Encountered below various errors caused by empty data when building a very basic Copy Data task from File Sharing to Azure SQL:
ErrorCode=TypeConversionFailure,Exception occurred when converting value '' for column name 'EndDate' from type 'String' (precision:, scale:) to type 'DateTime' (precision:255, scale:255). Additional info: String was not recognized as a valid DateTime.
And here is another one I believe caused by the same reason:
ErrorCode=TypeConversionFailure,Exception occurred when converting value '' for column name 'ContractID' from type 'String' (precision:, scale:) to type 'Guid' (precision:255, scale:255). Additional info: Unrecognized Guid format.
All I need is to treat empty data as NULL when copying to SQL Tables. The only option I have found is "Null value" in my CSV dataset; and it is set to nothing as default.
Below is the code of CSV dataset:
{
"name": "CSV",
"properties": {
"linkedServiceName": {
"referenceName": "CSV",
"type": "LinkedServiceReference"
},
"parameters": {
"FileName": {
"type": "string"
}
},
"annotations": [],
"type": "DelimitedText",
"typeProperties": {
"location": {
"type": "AzureFileStorageLocation",
"fileName": {
"value": "@dataset().FileName",
"type": "Expression"
},
"folderPath": "output"
},
"columnDelimiter": ",",
"escapeChar": "\\",
"firstRowAsHeader": true,
"quoteChar": "\""
},
"schema": []
}
}
The csv file does use double quotation marks as the qualifier. And those empty data in source files look like this:
"b139fe4d-f48a-4158-8196-a43500b3bf02","19601","Bar","2015/02/02","","","","","","","","","","",""