Statement return value

  • Hi Experts,

     

    I want to know whether the last sql statement is executed successfully or not.

    Say for example,

    select * from emp

    suppose if the 'emp' table doesn't exist in the database then it will give 'object doesn't exit' error message.

    My question is i want to know the last executed sql statement is successfully completed or not.

    Regards

    Karthik

     

     

    karthik

  • Have a look at @@error

    http://technet.microsoft.com/en-us/library/ms188790.aspx

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

  • shall we implement try...catch logic in sql2000 ?

     

    Regards

    Karthik

     

    karthik

  • Hi Karthik,

    it very much depends on your requirements. E.g. whether you can recover from an error, or you need to abort the transaction immediately. I would recommend you to read Erland Sommarskog's article on error handling in SQL Server 2000 and 2005. You can access it from his website under:

    http://www.sommarskog.se/error-handling-I.html

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

  • Thanks Andras !

    Mentioned Article is very nice !

     

    Regards

    Karthik

     

    karthik

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply