Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading SQLCA 1

Status
Not open for further replies.

clegg

Programmer
Jan 25, 2001
98
GB
I'm converting a 4GL program to VB and have a line of code as follows:

let fjeb.extbat = sqlca.sqlerrd[2]

The extbat field is a serial field and I believe this code returns what the new number is (after being inserted with a value of zero).

My question is how do I get to this in VB??

Please forgive me if this seems the wrong forum, but I wasn't sure whether to post it here or in the VB forum - so I've put it in both!!

Regards
Clegg
 
Hi,

In 4GL sqlca.sqlerrd[2] returns the serial number generated for a row inserted in a table having serial data type column. There are many ways to get this number from the backend engine:

To find out the sequence number generated execute sql:
SELECT DBINFO('sqlca.sqlerrd1') FROM systables WHERE tabid=1 ;

The above select statement is equivalent to SP (Stored Procedure):
CREATE PROCEDURE GetSerialNumber() RETURNING integer;
RETURN DBINFO('sqlca.sqlerrd1');
END PROCEDURE

To call the SP execute SQL:
EXECUTE PROCEDURE GetSerialNumber()

Regards,
Shriyan
"Knowledge is like a river... the deeper it is, the less noise it makes."
 
You are a genius - a star for my gratitude!

Clegg
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top