Raising an error to ADO

  • Hi,

    I have a question regarding the RAISERROR command in SQL when working with ADO.

    If you have SQL like:

     

    DECLARE @a INT

    RAISERROR('Test', ..., NOWAIT / SETERROR)

    SELECT * FROM table

     

    The RAISERROR works and the ADO's error collection contains the error.

    Now if you reverse the RAISERROR and SELECT, the ADO error collection does not contain the error.

     

    Does anybody know why, and does anybody know why the RAISERROR command seems to change depending on where its located in the SQL?  Any help is appreciated.

  • With the SQL Server ODBC or OLEDB drivers, only the FIRST status code is available.

    The SQL statements:

    RAISERROR (50000,10,1)

    RAISERROR (60000,10,1)

    Returns a status code of 50,000 and the status of 60,000 cannot be seen by the application program when using one of these drivers.

    SQL Query Analyzer and isql.exe do not exhibit this behavior because the DB-Library is used. In comparison, OSQL.EXE uses ODBC

    SQL = Scarcely Qualifies as a Language

Viewing 2 posts - 1 through 1 (of 1 total)

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