Add conditional check to a Stored Proc Query
-
Language:: T-SQL
-
Context:: This is so that can filter according to the parameter if it has been passed to the proc
-
Description
-
Snippet
-- Add the AND with the check or to add the conditional check to the proc query
WHERE FirstParameter = @FirstParameter
AND (
@Parameter = 0 OR (
@Parameter != 0 AND (Parameter = @Parameter)
)
)
- Dependencies::
📇Additional Metadata
- 📁Type::#type/snippet
- 🏷️Tags:: Database, MS Sql
- 📡Status::#status/🌲