Null to SQL for DateTime Variable and default datetime value in SQL

Hey everyone, I’ve looked up similiar questions but have not found an answer that works with my situation. I have a datetime variable in UiPath that is going to input its value into a datetime column in SQL. Sometimes the variable in UiPath doens’t pick up a value, so the value should be sent to SQL as ‘NULL’.

I tried to use a nullable value in UiPath and set the variable as new nullable(datetime) but if that gets placed into SQL it doens’t get input as ‘NULL’ it gets input as a default lowest datetime value, something like ‘1901-01-01’. Is there a way to pass it to SQL as NULL?

Right now my only solution has been to place the varible in uipath in an if statement and if the parse gets a value of “” then it doens’t put anything into sql but if it does then that variable gets its own individual SQL connect/ update/ disconnect statement and the other variables I pick up on that page are housed together in a seperate sql section.

Try to assign the value to DbNull.Value in your datatable

Use Type as Object and Value as DBNull