I am attempting to combine two stored procedures into one. Previously I had:
@argument int
SELECT val1, val2, val3
FROM table as x
INNER JOIN(
... ) as y
ON x.val1 = y.val2
WHERE someCondition = @argument
Then I would fire a virtually identical stored procedure, where the only difference was the condition.
I would like to find a way to combine these procedures to create something like this:
@argument int
SELECT val1, val2, val3,
isCondition1 = true -- Additional return value
FROM table as x
INNER JOIN (
... ) as y
ON x.val1 = y.val2
WHERE someCondition = @argument
SELECT val1, val2, val3,
isCondition1 = false -- Additional return value
FROM table as x
INNER JOIN(
...) as y
ON x.val1 = y.val2
WHERE someOtherCondition = @argument
Is this possible?