Professional Web Applications Themes

How to catch errors - Microsoft SQL / MS SQL Server

error catching with current versions of sqlserver is very weak. once a sql *fatal* error (syntax error and conversion error are examples of these fatal errors) occurs the entire batch is terminated. here is some doc on how to catch an error in sqlserver. [url]http://msdn.microsoft.com/library/en-us/tsqlref/ts_globals_9ghe.asp?frame=true[/url] -- -oj RAC v2.2 & QALite! [url]http://www.rac4sql.net[/url] "anson" <aeze616cse.unsw.edu.au> wrote in message news:cb7ba330.0306291728.3d1c9297posting.google.c om... > Dear sir, > > I have a problem with date conversions. I want to catch an error > like this in a stored procedure using something like RAISERROR but I'm > not sure what to do. > > For example, ...

  1. #1

    Default Re: How to catch errors

    error catching with current versions of sqlserver is very weak. once a sql
    *fatal* error (syntax error and conversion error are examples of these fatal
    errors) occurs the entire batch is terminated.

    here is some doc on how to catch an error in sqlserver.

    [url]http://msdn.microsoft.com/library/en-us/tsqlref/ts_globals_9ghe.asp?frame=true[/url]

    --
    -oj
    RAC v2.2 & QALite!
    [url]http://www.rac4sql.net[/url]



    "anson" <aeze616cse.unsw.edu.au> wrote in message
    news:cb7ba330.0306291728.3d1c9297posting.google.c om...
    > Dear sir,
    >
    > I have a problem with date conversions. I want to catch an error
    > like this in a stored procedure using something like RAISERROR but I'm
    > not sure what to do.
    >
    > For example, I want to convert the date '56th December 2004' i.e.
    > 56/12/2004. It raises an error and gives me an error message number.
    > Is it possible to catch the error message number so I can output my
    > own error message?
    >
    > zeallous

    oj Guest

  2. #2

    Default Re: How to catch errors



    Dear sir,

    Hmm...I checked that page as well. but for example:

    Select convert(datetime, '20035645', 103), it should raise an error
    saying 'arithmetic overflow'. Instead of that message, is it possible to
    override it with mine? I know as you said, it's weak. But does that mean
    its not doable?

    zeallous


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Anson Z Guest

  3. #3

    Default Re: How to catch errors

    Anson Z (aeze616cse.unsw.edu.au) writes:
    > Hmm...I checked that page as well. but for example:
    >
    > Select convert(datetime, '20035645', 103), it should raise an error
    > saying 'arithmetic overflow'. Instead of that message, is it possible to
    > override it with mine? I know as you said, it's weak. But does that mean
    > its not doable?
    Yes, you are completely out of luck. You have to manipulate this in the
    client.


    --
    Erland Sommarskog, SQL Server MVP, [email]sommaralgonet.se[/email]

    Books Online for SQL Server SP3 at
    [url]http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp[/url]
    Erland Sommarskog Guest

Similar Threads

  1. CF4.5 Errors in logs and Unix 111 errors!
    By PoDd69 in forum Coldfusion Server Administration
    Replies: 0
    Last Post: February 15th, 10:24 AM
  2. Replies: 1
    Last Post: October 7th, 01:51 PM
  3. [PHP] Try/Catch
    By Jay Blanchard in forum PHP Development
    Replies: 0
    Last Post: September 8th, 08:22 PM
  4. Try/Catch
    By -- in forum PHP Development
    Replies: 0
    Last Post: September 8th, 12:04 PM
  5. The best way to catch errors
    By Gennady Bystritsky in forum Ruby
    Replies: 1
    Last Post: July 5th, 06:11 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139