use like operator in sql string

  • 267 Views
  • Last Post 03 August 2018
  • Topic Is Solved
giulio posted this 27 July 2018

Hi,

in my workflow I want to filter the list extracted through a sql.

I have set a first question where I input the value of the search (% filter%)

in the second question i sets a type selected from sql

in the query i have set

"select pratica_numero, client_name from pratiche

where cast(pratica_numero as varchar(5)) like %filtro% order by pratica_numero desc"

 

the column pratica_numero is a integer value

now in the first question i put the value es 403%, in the next question the result of picklist is empty

 

any help?

Giulio

Order By: Standard | Newest | Votes
tis06 posted this 30 July 2018

I would do it as follow

select pratica_numero, client_name

from pratiche

where UCASE(cast(pratica_numero as varchar(5))) like UCASE('%%filtro%%')

order by pratica_numero desc

 

The UCASE is so you don't have to worry about case sensitive. Not important in this case with a number. But it is with names and others. And you have to double the % so there will be one for sql and one for the variable. It worked for me this way.

You put 403 in the filter field, with no %

Frédéric

  • Liked by
  • luca.scarpati
giulio posted this 03 August 2018

Hi,

it works !!!

thanks a lot

Giulio

Close