Send 'NULL' to SQL table from Execute Non Query Parameters

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+”')"

image

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 :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

1 Like

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’)

null

Hi @aod

Try like this. Within Double quotes give single quotes and space in between single quotes.
image

Hope this may help to solve your issue
Mark as solution if this helps you and like it :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

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

Thanks, but unfortunately “’ '” just inserts …

' '

…into the field, and not NULL.

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

1 Like

Ok, then you answered your own question :slight_smile: 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:
image

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”:
image

Hope this helps :slight_smile: