aod
July 2, 2020, 3:32pm
1
I would like to know how to pass a NULL value from a UiPath Execute Non Query activity, within the Value field of the Parameters , to a SQL Table.
Note that the Type could be a string – but the problem is, any value you put in the value box needs to be a string, or to have .tostring added?
The NULL value is not a string, I don’t want a blank cell, or 0, but actually NULL .
It can be done in the actual SQL query by using:
SET ColName = NULL
…but I’m using Parameters, so it would be
SET ColName = @ParameterName
…which would set the Value of the ParameterName argument.
I need to know what this Value field should be set to, to parse ‘NULL’ to the SQL table from UiPath.
‘NOTHING
’ doesn’t work, and ""
just leaves blank cell.
Can anyone assist?
Hi @aod
Below is the format
(‘“+endOfSession+”’,’ ‘,’ ‘,’ ‘,’ ‘,’“+net_bilateral+”')"
In above eg ,’ ', this is what i used for sending NULL as a value. The above works for me in one of the scenario.
Hope this may help to solve your issue
Mark as solution if this helps you and like it
Happy Automation
Best Regards
Er Pratik Wavhal
1 Like
aod
July 2, 2020, 3:57pm
3
Thanks but unfortunately it’s not clear what you mean?
I’ve tried using “'” which inserts a ’
Can you clarify the characters needed please?
Below is the field I need to insert the the NULL value.
(NULLTHIS - where it says ‘VALUE HERE’)
Hi @aod
Try like this. Within Double quotes give single quotes and space in between single quotes.
Hope this may help to solve your issue
Mark as solution if this helps you and like it
Happy Automation
Best Regards
Er Pratik Wavhal
bcorrea
(Bruno Correa)
July 2, 2020, 5:47pm
5
Depends on what is the type of the parameter, but maybe try assign parameter value to DBNull.Value
and for string, maybe a simple Nothing
could work.
1 Like
aod
July 3, 2020, 8:11am
6
Thanks, but unfortunately “’ '” just inserts …
' '
…into the field, and not NULL.
aod
July 3, 2020, 8:13am
7
Hi
In this case the type is a String, so DBNull.Value
won’t work, and as mentioned in my original post I’ve already tried Nothing
aod:
NOTHING
’ doesn’t work,
1 Like
bcorrea
(Bruno Correa)
July 3, 2020, 2:49pm
8
Ok, then you answered your own question If you need to be able to insert null value into your table, you will need to change that parameter from String to Object so you can assign it to DBNull.Value.
2 Likes
Hi,
I was facing the same prblem…
I have a string with my ‘Update’ query, and need to perform a ‘.Replace’ over that string, assigning a null value to a certain field:
UiPath Studio says “‘Null’ constant is not longer supported; use ‘System.DBNull’ instead.”, but 'System.DBNull.Value can not be converted to a string inside a ‘Replace’ command.
So… I replace my tag within the query with “null” (which is a string inside the “.Replace”), and then executing the query it is resolved as “field = null”:
Hope this helps