Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Stored procedure help

    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!

  • #2
    New Coder
    Join Date
    Jan 2009
    Posts
    91
    Thanks
    17
    Thanked 1 Time in 1 Post
    Can you give an example of your current code?

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,720
    Thanks
    80
    Thanked 4,514 Times in 4,478 Posts
    Is this what you are looking for??
    http://dev.mysql.com/doc/refman/5.1/...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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •