[unixODBC-support] Check result of all row sets after SQLExecute()
Martin Evans
martin.evans at easysoft.com
Thu Jul 9 15:25:10 BST 2009
Daniil A Megrabjan wrote:
> Hello All.
>
> I have querie like this(Its only example, not real query!):
> DECLARE @res numeric(1)
> SELECT @res=2
> DELETE FROM dbo.TABLE1... (query 1)
> DELETE FROM dbo.TABLE2... WHERE 1=2 (query 2)
> SELECT @res
>
> In my cpp app I do for it:
> success = SQLPrepare(Stmt, (unsigned char *) SQL, SQL_NTS);
> success = SQLExecute(Stmt);
>
> My main trblz in processing the result codes of all row sets... How I
> can do this? Because, for example:
>
> My "query 1" success = 1 (The DELETE statement conflicted with the
> REFERENCE constraint "FK__T_KLS_ALL__KLSRE__1DE1DF5A". The conflict
> occurred in database "infin_web_2008", table "dbo.T_KLS_ALL", column
> 'KLSREF_NUM')
>
> My "query 2" success = 100 (No affected rows!)
>
> If I execute this queries(1&2) in common one (as in first example) I
> have total success = 1 from first DELETE(from 1 rowset). But if I
> change position of queries in batch, like:
>
> DECLARE @res numeric(1)
> SELECT @res=2
> DELETE FROM dbo.TABLE2... WHERE 1=2 (query 2)
> DELETE FROM dbo.TABLE1... (query 1)
> SELECT @res
>
> I have success=100, and I don't know anything about second "success" of query.
>
> How I can check all success codes of all row sets?
>
> Thanks!
>
See SQLMoreResults.
Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com
More information about the unixODBC-support
mailing list