...

View Full Version : Stored procedure help



xsl-newb
04-30-2009, 06:30 PM
I need help with a stored procedure I am writing.

If a certain condition exists, I need to perform inserts to two separate databases.

First, I insert a new record into database A, using three variables whose values are retrieved from an XSLT transformation that is done. However, there is a fourth column in each record in Database A called "ID". This field is automatically generated with a unique identifier (int) each time a new record is created.

My second insert, into Database B, needs to include the unique identifier that was just created for the record in question in Database A. Since I don't know what that value is, I need to find a way to select it from Database A.

Any help here would be great.... Thanks!

Hayyel
05-02-2009, 02:40 AM
Can you give an example of your current code?

Old Pedant
05-02-2009, 04:31 AM
Is this what you are looking for??
http://dev.mysql.com/doc/refman/5.1/en/stored-routines-last-insert-id.html

If this ID column with the unique identifier that you referred to is *NOT* an AUTOINCREMENT column, then show us the DB schema for it and how you generate the values for it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum