I came across this situation and because I couldn’t find a straight answer, I thought to paste here - what I consider to be - the solution.
SQL doesn’t know what type UiPath is pushing. SQL will try to cast to the type it’s required at the time of the table creation.
So for example, let’s say you have a table in SQL, with a column of DateTime type. When you push it through UiPath, you can do:
- Type String, variable:
- or, you can push a DateTime Type (SQL is not aware at this point), and a variable like:
I’ve just invented 2 scenarios above. SQL will try to parse the input (the above from UiPath) into its own data type.
- in the first scenario you might push a ‘6/5/2020’ as May 6, but SQL to parse it as June 5th, because it depends on your regional and config settings. So you have to be careful with the conversion.
- in the second scenario above, everything is converted successfully (direct) way.
Now, back to your point, about the NULLs:
If you take care of your instantiations carefully in UiPath, why not pushing it as an Object type (as remember, SQL will do the rest)
I will give some examples below:
In the above examples:
- If you are absolutely sure that you don’t have NULLs in your DateTime, you can keep the type set as ‘DateTime’.
- If you know that you might have missing dates and you want the NULL in your DB, then make it Object.
I wanted to prove a point - there are many examples we can give. The idea is to make sure you are pushing a correct value for SQL to parse. Don’t just assume the date is correct, because Object will not through you an error.
- The same goes with other types, like I did above with Arg3 and Arg4. So if you know that you might have NULLs, the DB will take the value pushed by UiPath and try to cast it to float let’s say. So, in case you have myDouble sent as null, you will have in your DB the following
- 0 (zero) (if Type is Double - Arg3)
- NULL (if Type is Object - Arg4)
I tend to write a lot - so apologies - but if you pay attention, you should be able to implement it successfully.