I have a SP which needs a parameter of type int.When by mistake any varchar or nvarchar value is passed instead of int for this parameter it gives the error message like this-
Server: Msg 8114, Level 16, State 4, Procedure getNewsdetails2, Line 0
Error converting data type varchar to int.
My question is that how can I trap this error by my own?I like to place a code which will check the datatype for this input parameter and if the datatype is not int it will send a message to the user.
Is it possible?How?
And at the same time there is a problem.If float value (like 2.5..33) is passed it is not returning any merror and returning some results.But I don't like to execute the SP like that.My criteria is that only values of 0,1,2,3 can be allwed.Any other value or floating value is disallowed.
How can I do that?