I have created a stored procedure that accepts 3 parameters.
@row int
,@column VARCHAR(17)
,@value int
I want the @value parameter to accept either text or integer because it updates different columns depending on @column parameter.
Please advise
Don’t do this, make two stored procedures with different signatures and names. Then you wont need the
@columnparameter and each stored procedure will be simple and behave consistently.You’ll be trading
IFs andCASEes for stored procedure definitions. The query plans for the procedures will behave consistently so could be reliably cached and you’ll write about the same number lines overall.Stored procedures that do widely different queries based on the parameters passed are a performance problem waiting to happen.