I want to select a stored proc to execute based on user input. Something like -
EXEC
CASE @InputParam
WHEN 'XML' THEN GetXMLData @ID, 'y'
WHEN 'TABLE' THEN GetTableData @ID, 'y'
END
Can this be done with CASE
or should I consider using the If
construct?
CASE
is used for inline evaluation within a query. You wantIF
since it's a flow control construct. – Testa