cancel
Showing results for 
Search instead for 
Did you mean: 

Fixed SQL Query if Paramerter empty

nwalter1
Explorer

Hi,

I'm using the following where condition in a fixed sql query:

and ([NC_DATA].WORK_CENTER_BO LIKE '%[Param.4]%' OR '[Param.4]' IS NULL)

and its working fine when I enter a value for Param.4, but when I don't use Param.4 it's not giving the NULL paramter only data with values. How can I achieve that I get data with values and also data = NULL

Thanks for helping.

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Perhaps you need to always have a dummy Param.4 value when you don't have a value to insert. If you do not apply a value to Param.4, then your Like '%%' will return values since all the WORK_CENTER_BO meet that criteria. If you do not want the values returned, then use something like '----' as the default value of Param.4.

nwalter1
Explorer
0 Kudos

If I not apply a value to Param.4 I want all values incl. NULL returned --> Right now I only get all values without NULL.

And if I apply a value to Param.4 only the matches should be returned.

I hope that make it more clear