Solved

Informix - sqlca.sqlerrd1 variable?

Posted on 1997-08-01
1
1,405 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
multiple application databases same MSSQL instance 5 79
form builder not starting 3 73
simple bash script needed to unpack tar.gz 4 31
error in oracle form 11 29
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
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…

730 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