Solved

Informix - sqlca.sqlerrd1 variable?

Posted on 1997-08-01
1
1,432 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

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…
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

691 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