Re: How to have SQL_ERROR returned from RAISERROR within IF-BLOCK
- From: Pak-Ming Cheung [MSFT] <PakMingCheungMSFT@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 21 Aug 2008 00:54:10 -0700
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.
- References:
- RE: How to have SQL_ERROR returned from RAISERROR within IF-BLOCK
- From: Pak-Ming Cheung [MSFT]
- Re: How to have SQL_ERROR returned from RAISERROR within IF-BLOCK
- From: M. Shoaib Surya
- RE: How to have SQL_ERROR returned from RAISERROR within IF-BLOCK
- Prev by Date: RE: odbccommand cant interpret some /*xxx*/ comments
- Next by Date: RE: Text file driver ODBC issue
- Previous by thread: Re: How to have SQL_ERROR returned from RAISERROR within IF-BLOCK
- Next by thread: achat zocor suisse achat zocor belgique commande en ligne acquerir acheter zocor us usa soft dans commande achat zocor corpus acheter zocor canada le plus bon marche
- Index(es):
Relevant Pages
|
Loading