Results 1 to 4 of 4

Thread: Int vs Varchar

  1. #1
    Join Date
    Oct 2003
    Posts
    83

    Post Unanswered: Int vs Varchar

    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?
    Subhasish

  2. #2
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    The trapping of such errors goes in the frontend and not the database.
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  3. #3
    Join Date
    Oct 2003
    Posts
    83
    SO is it possible from the backend or not?

    Subhasish

  4. #4
    Join Date
    Oct 2003
    Posts
    83
    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?
    Subhasish

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •