Trying to obtain more information after SQLExecute fails (Bound Columns) 
Author Message
 Trying to obtain more information after SQLExecute fails (Bound Columns)

When doing a large SQL statement with many bound columns, if an error
occurs, it is difficult to narrow down which column is having the
problem.  (Data truncation, NULL data in a row that should not have
it, etc...)

We have used all of the variations of the SQLGetError, SQLGetDiagRec
etc methods and can get the SQL error codes, but they don't tell about
the specific column in error.  If we break the SQL statment down, or
only bind half of the columns until the error goes away, then we can
find the error, but it very time consuming.

Like the following:

while ( SQLGetDiagRec( htype,
                           hndl,
                           i,
                           sqlstate,
                           &sqlcode,
                           message,
                           SQL_MAX_MESSAGE_LENGTH + 1,
                           &length
                         ) == SQL_SUCCESS ) {
          sprintf( szLog + strlen(szLog), "\n  SQLSTATE = %s\n",
sqlstate
) ;
       sprintf( szLog + strlen(szLog), "  Native Error Code = %ld\n",
sqlcode )
;
       sprintf( szLog + strlen(szLog), "%s\n", message ) ;
       i++ ;
    }

  Thanks.



Sun, 17 Jul 2005 12:44:54 GMT
 Trying to obtain more information after SQLExecute fails (Bound Columns)

Quote:

> When doing a large SQL statement with many bound columns, if an error
> occurs, it is difficult to narrow down which column is having the
> problem.  (Data truncation, NULL data in a row that should not have
> it, etc...)

> We have used all of the variations of the SQLGetError, SQLGetDiagRec
> etc methods and can get the SQL error codes, but they don't tell about
> the specific column in error.  If we break the SQL statment down, or
> only bind half of the columns until the error goes away, then we can
> find the error, but it very time consuming.
> ...

Did you try SQLGetDiagField ()?
Use it with the 4th argument SQL_DIAG_COLUMN_NUMBER and call it several times
with a rec number (3rd argument) increased until the return code is different
from SQL_SUCCESS.

ATNT



Sun, 17 Jul 2005 21:41:25 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. how can i obtain column information (using DB-LIB and CURSORS)

2. Select/Into statement fails On SQLExecute Method

3. Select/Into statement fails On SQLExecute Method

4. Timeout when updating blob column using SQLExecute

5. Bound texbox fails to Bind on some machines

6. Bound textbox fails to bind on some machines

7. Distributed Transaction Failing on First Try, Second Try Works

8. How do I bind columns from several tables to one bound control in VB 5.0

9. How to obtain the value of bind variables?

10. How to obtain SQL Server edition information using VB6

11. Obtaining Cube information in Java

12. Obtaining Drive Space Information


 
Powered by phpBB® Forum Software