Skip to content
Advertisement

Like in dynamic function

The code below works well. I however have issues trying to turn it into a like statement that I need some assistance with

So far, I have tried the code below but with not much success

I have also tried;

Advertisement

Answer

If your stored procedure parameter is @deliverer and your dynamic SQL parameter is @pt, I believe your sp_executesql execution should assign the parameter as @pt = @deliverer.

As for adding wildcards, you can either add them before the call with

or add them in the dynamic SQL with

Note the doubled up quotes around the %. The variable @pt is not quoted

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement