Solved

Informix - sqlca.sqlerrd1 variable?

Posted on 1997-08-01
1
1,395 Views
Last Modified: 2008-07-03
The following SQL is working as expected;

INSERT INTO TABLE(COLUMN1) VALUES (VALUE1);

This INSERT is inserting a column, COLUMN1, and a serialized column,
COLUMN2, not shown. COLUMN2 gets incremented automatically.

SELECT SERIALIZEDCOLUMN FROM TABLE WHERE SERIALIZEDCOLUMN =
DBINFO('sqlca.sqlerrd1');

This SELECT statement returns the thread specific SERIALIZEDCOLUMN that was
just inserted.  Everything is working as I would expect.

QUESTION?

Is there any other way to get the sqlca.sqlerrd1 variable, without issuing
a SQL statement.  A "C" routine would be nice, or any other method.

The problem is I want to read this value directly without issuing a second
SQL statement.

I am using VB5 as the VCL.

Any help would be greatly appreciated.

Carl

0
Comment
Question by:cfulton
1 Comment
 
LVL 9

Accepted Solution

by:
cymbolic earned 50 total points
ID: 1025201
I don't think there is another way.  You have to read it from the database, because it doesn't exist until the row is added to the table.  It's not in your resultset in memory to be accessed. It get's generated from internal system tables by your server when the row is written. For some additional insight into what your access method sees and is doing, set logging/trace on in your ODBC Connection  using your ODBC connection  Manager, then review the details of what's actually transpiring when you do one of these inserts.  I don't think you'll see the serialized number ever coming back to your VB app.

Also, you can't even "read ahead" and guess that the next number will be one higher than the current maximum number, because that doesn't work in a multiusr environment.

If you're really desparate, don't use an autonumber field.  Set up your own control table to control and select new numbers, or use a very large random random generated floating point number to serialize.  That way you are in control, since you hand out the numbers, not your server.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
TypeError: Users.save is not a function 3 60
syadmin MSSQL 2 71
add and run outdated exchange database to an Exchange server 1 45
T-SQL: New to using transactions 9 46
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question