Re: How to have SQL_ERROR returned from RAISERROR within IF-BLOCK



So, do you mean that SNAC driver is not fully-compatible with sqlsrv32.dll?
And you cannot use it in your application.

===========

The root cause of the problem is in the server-side response.
The problem has been fixed in SQL Server 2005. Therefore, you may try to
upgrade the server to 2005.

Thanks,
Ming.
MDAC Team, Microsoft.


"M. Shoaib Surya" wrote:

Ming,
Thanks for you reply - Sorry that I missed it for a few days.

No, using the native client is not an option available to me here. I can not
even modify the sequence of ODBC function calls and checking of the return
types here.

As I had said in my original post, my main requirement is to have SQL_ERROR
returned with with a custom error message if some particular table exists in
the database. The only solution I could work out was to execute a query for
each of the tables within the client code and check the result-set to
identify if the table exists in the database or not.

Can you give me any other out-of-the-box suggestions to help reach any other
solution to this thing, preferably using a single SQL statement for each
table?

Thanks a lot

Regards,
Shoaib.

"Pak-Ming Cheung [MSFT]" <PakMingCheungMSFT@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote
in message news:6DFF704E-82CE-4F5C-B1EB-9B091B3FDAE7@xxxxxxxxxxxxxxxx
Could you try the SQL Native Client?

Thanks,
Ming.



"M. Shoaib Surya" wrote:

Hi
I am using MS SQL Server 2000.
I want to return SQL_ERROR to my application with a custom error message
from ODBC.

From what I could find form the documentation, RAISERROR statement with
severity of 11 or more is the way for me to go.

I get it returned fine when I execute the following statement using
SQLExecDirect:
RAISERROR('My error message', 11, 1)

But it returns SQL_SUCCESS_WITH_INFO rather than SQL_ERROR when I put the
RAISERROR statement within an IF-block and execute it as follows:

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id =
OBJECT_ID('dbo.my_table')
AND OBJECTPROPERTY(id, 'IsUserTable') = 1)
RAISERROR('My error message', 11, 1)

From what I could find in the forums makes me understand that this
happens
because I am executing a batch of statements and in this case ODBC would
return SQL_SUCCESS_WITH_INFO. But I am using a wrapper library over ODBC
and
I must have SQL_ERROR returned from SQLExecDirect. My main requirement is
to
have SQL_ERROR returned with with a custom error message if some
particular
table exists in the database. Can anyone give me any suggestions or
solutions to help achieve this thing?

Thanks in advance

Regards,
Shoaib.






.



Relevant Pages

  • Re: -2147217887 [Microsoft][ODBC SQL Server Driver]Optional feature not implemented
    ... > I'm trying to execute a stored procedure in SQL Server 2000 from a VB^ ... Data Sources (ODBC) control panel's Tracing tab. ... You may want to try using a different ODBC Driver for SQL Server, ... Universal Data Access and Virtual Database Technology Providers ...
    (microsoft.public.data.ado)
  • Re: -2147217887 [Microsoft][ODBC SQL Server Driver]Optional feature not implemented
    ... > I'm trying to execute a stored procedure in SQL Server 2000 from a VB^ ... Data Sources (ODBC) control panel's Tracing tab. ... You may want to try using a different ODBC Driver for SQL Server, ... Universal Data Access and Virtual Database Technology Providers ...
    (microsoft.public.vb.database.ado)
  • Re: integrated Secure
    ... >I want to set integrated Secure in my connect string to SQL Server ... > But when I execute my web application, it result an error at line: ... > The error message is 'NT AUTHORITY\NETWORK SERVICE' ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: How to have SQL_ERROR returned from RAISERROR within IF-BLOCK
    ... using the native client is not an option available to me here. ... even modify the sequence of ODBC function calls and checking of the return ... I want to return SQL_ERROR to my application with a custom error message ... I get it returned fine when I execute the following statement using ...
    (microsoft.public.data.odbc)
  • Re: sql server + ODBC: error suppressed
    ... I have a program that connects to SQL Server through ODBC, one of my clients ... no error message is displayed either (which is strange and it works fine on ... are there any configuration parameters on sql server or ODBC ...
    (microsoft.public.sqlserver.server)

Loading