-1

Is it possible to use a Prepared Statement in MSSQL (not PDO) placeholder in a LIKE statement in combination with a "%"?

I played a little bit with the code and ended up with this:

WHERE column LIKE ?%

and the parameter is "test1_" so I want to get all results for "test1_%"

But it doesn't work

Snickbrack
  • 1,253
  • 4
  • 21
  • 56
  • Uhm, the answer isn't any different for MSSQL. Not sure what you want to imply here. Do you think we should have hundreds of duplicates just because some people don't understand the irrelevancy of SQL flavour and querying API? – mario May 28 '15 at 13:09
  • No, you should not have hundrets of duplicates of an answer. But most of the people (like me) which are looking for a sufficient answer for e.g. prepared statements in mssql are not looking for answers for PDO. So you say that when I use the code of the answer then it will work? PDO is not the same to the mssql thing and if it would be the same then it would be named the same. – Snickbrack May 28 '15 at 13:50

1 Answers1

5

Yes you can you do it like this:

WHERE column LIKE ?

And the parameter would contain:

'%'.$yoursearchword.'%'
Daan
  • 12,099
  • 6
  • 34
  • 51