On 1/5/2011 13:31, James Dekker wrote:
Because some sequence tables contain one to many cardinality and MySQL tables 
can only have one auto_increment column...

Is there a way to do what I am trying to do (obtain max sequence id, set it to 
its corresponding table, and then increment by one) in a stored function?


Maybe some variation of this will help?
http://stackoverflow.com/questions/805808/emulating-a-transaction-safe-sequence-in-mysql

I don't understand the need for a SEQUENCE. In my history, if there is some kind of object identifier you want to use, then an auto_increment field on the row that defines the object itself is sufficient. Then all child elements of that object can include the autogenerated ID value from their parent object as you create them alongside of any unique identifiers they may require.
http://dev.mysql.com/doc/refman/5.1/en/information-functions.html#function_last-insert-id

Have you also explored the use of auto_increment columns as part of a multiple-column index on MyISAM tables as described here?

http://dev.mysql.com/doc/refman/5.1/en/example-auto-increment.html


--
Shawn Green
MySQL Principal Technical Support Engineer
Oracle USA, Inc.
Office: Blountville, TN

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to