TSQL - Stored Procedure - help with Conditionals
Posted on 2011-03-16
Experts, I'm trying to alter a stored procedure which optionally accepts to parameters (a filter, and column to filter).
I'm not sure how to write the conditional logic. In the application, I would write the query as:
WHERE this = 'that'
if X is not null and y is not null then
AND x LIKE '%y%'
However, I'm not sure what the syntax is in tsl for a stored procedure.
Additionally, I can either pass or not pass the arguments to the stored procedure based on a value check, if that helps.
Correct syntax would also be greatly appreciated. Thanks!