mysql - How to achieve unique auto-incremented id for rows across multiple tables? -
i've got several tables in database, let's they're called table1, table 2, etc. tables have primary key column 'id' auto-increment.
in current configuration happens when inserting table1, generated id 1. afterwards when inserting table2, generated id happens 1 well.
how force absolutely unique ids across tables in database? want when inserting table1, generated id 1, , if afterwards inserting table2, generated id 2?
i used mysql server on machine , did not have problem, when installed mysql on local machine, started occur. guess must kind of setting applied mysql configuration?
thank you
you can use uuid.
insert mytable(id, name) values(select uuid(), 'some data');
read more uuid: http://mysqlbackupnet.codeplex.com/wikipage?title=using%20mysql%20with%20guid%20or%20uuid
Comments
Post a Comment