ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » ESQL Database Insert Retreive Auto ID

Post new topic  Reply to topic
 ESQL Database Insert Retreive Auto ID « View previous topic :: View next topic » 
Author Message
kayhansefat
PostPosted: Mon Jul 23, 2007 1:11 am    Post subject: ESQL Database Insert Retreive Auto ID Reply with quote

Acolyte

Joined: 18 Oct 2006
Posts: 65

Hi,

I have a DB2 table where every row is automatically assigned a row ID. Does anyone know if it is possible to retrive this ID when I call an 'INSERT INTO' esql call?

Thanks.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jul 23, 2007 1:40 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I've always had to run a passthru to call the DB specific function to return the last ID
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Mon Jul 23, 2007 1:59 am    Post subject: Re: ESQL Database Insert Retreive Auto ID Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi kayhansefat,
kayhansefat wrote:
I have a DB2 table where every row is automatically assigned a row ID. Does anyone know if it is possible to retrive this ID when I call an 'INSERT INTO' esql call?
No, I don't think this can be done...

If you have inserted unique fields in the insert, then you can do a SELECT again and find the row ID...

Else make a stored procedure (which internally will do the same thing) and return the new row ID.

There is a way to find the last inserted index id but if you have multiple flows or apps inserting into the table, then this might not be so reliable...

Regards.
Back to top
View user's profile Send private message Send e-mail
kayhansefat
PostPosted: Mon Jul 23, 2007 5:52 am    Post subject: Reply with quote

Acolyte

Joined: 18 Oct 2006
Posts: 65

Right thanks for both your replies. Yes at the moment I am doing a SELECT to get the rowID so I will stick to that.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » ESQL Database Insert Retreive Auto ID
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.