If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > getting serial number after insert

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-05-07, 04:41
soneliso soneliso is offline
Registered User
 
Join Date: Sep 2007
Posts: 2
getting serial number after insert

Hi

I new to informix, but i trying to get serial number after performing an insert statement.

Thanks
Reply With Quote
  #2 (permalink)  
Old 09-05-07, 10:06
Tyveleyn Tyveleyn is offline
Registered User
 
Join Date: Aug 2006
Location: The Netherlands
Posts: 248
Hi, within one session you can do the insert and retrieve the last inserted serial value with:
Code:
INSERT INTO serialtest VALUES(0, 'Mickey', 'Mouse');     
SELECT DISTINCT dbinfo('sqlca.sqlerrd1') FROM serialtest;
Regards
Reply With Quote
  #3 (permalink)  
Old 09-05-07, 10:19
soneliso soneliso is offline
Registered User
 
Join Date: Sep 2007
Posts: 2
Getting serial number after insert

Thanks

I am sure it works the same way as this one, SELECT DBINFO('SQLCA.SQLERRD1') as serialid FROM systables WHERE tabname = 'mytablename'

Thanks again for the reply i really appreciate it
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On