SyntaxFix
Write A Post
Hire A Developer
Questions
You want the CASE statement
WHERE OrderNumber LIKE CASE WHEN IsNumeric(@OrderNumber)=1 THEN @OrderNumber ELSE '%' + @OrderNumber END