This is my string that works if the data has values in it
(DT_DBTIME2,7)(SUBSTRING(TMLMOD1,1,2) + ":" + SUBSTRING(TMLMOD1,3,2) + ":" + SUBSTRING(TMLMOD1,5,2))
It fails when there are nulls in the field.
Can you tell me how to check for nulls?
This is my string that works if the data has values in it
(DT_DBTIME2,7)(SUBSTRING(TMLMOD1,1,2) + ":" + SUBSTRING(TMLMOD1,3,2) + ":" + SUBSTRING(TMLMOD1,5,2))
It fails when there are nulls in the field.
Can you tell me how to check for nulls?
I tried this and it does not work if the field is empty
(TMLMOD1 == "") ? NULL(DT_DBTIME2,7) : (DT_DBTIME2,7)(SUBSTRING(TMLMOD1,1,2) + ":" + SUBSTRING(TMLMOD1,3,2) + ":" + SUBSTRING(TMLMOD1,5,2))
But still works if I put data in that field.
I tried with the expression you provided, it works well in my side.
Could you please have a double check or share the error message with us?

Also you may try with below expression to see if it is helpful.
(TRIM(TMLMOD1) == "") ? NULL(DT_DBTIME2,7) : (DT_DBTIME2,7)(SUBSTRING(TMLMOD1,1,2) + ":" + SUBSTRING(TMLMOD1,3,2) + ":" + SUBSTRING(TMLMOD1,5,2))
Regards,
Zoe
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Hot issues October
4 people are following this question.
SSIS Scale Out and its services on local group policies
Where do I download SSDT July 2016 Update (ver. 14.0.60629.0) from?
we hope Microsoft can develop databases like mysql
integration services ne figure pas dans la liste des fonctionnalités partagées de sql server
SSIS - getting data from Oracle - not working preview and metadata refresh