none
Looking for a Best Practice. RRS feed

  • Question

  • I have an order entry system.  What is the best practice for getting/setting a new order number.  Do you wait until you commit the data to the db to get the order number?  Or do you get a new order number first? 

     

    Thanks

     

    Bryan

    Thursday, August 23, 2007 2:38 PM

Answers

  • In my stored procedures i typically define an output parameter for everything it will change (eg: generate a new id)..
    So the id is generated in the same transaction where the order is persisted...
    And after the sproc call i can find the actual id in the  output parameters Smile
    Thursday, August 23, 2007 3:27 PM

All replies

  • In my stored procedures i typically define an output parameter for everything it will change (eg: generate a new id)..
    So the id is generated in the same transaction where the order is persisted...
    And after the sproc call i can find the actual id in the  output parameters Smile
    Thursday, August 23, 2007 3:27 PM
  • That was the direction that I was going. 

     

    Thanks

     

    Bryan

    Thursday, August 23, 2007 3:34 PM