Next Unique Number - Generation
Next Unique Number - Generation
am 21.07.2011 08:18:08 von Vikram A
--0-2061476704-1311229088=:27261
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Hi there,
I need a technical help fro you,
I have developed a sof=
tware for college & school. Here we have concept called register number/adm=
ission number. These are two=A0unique=A0umber for each student. My=A0applic=
ation=A0resides Client/server model.
These numbers will be generated (=
some defined format) to each student when they are=A0admitted at first time=
.. This admission process is taken place at different nodes at a time. =
=0AIn this=A0scenario, I am facing=A0difficulty that, the same number is ge=
nerated at time in two machines. (Logic is newest number will be=A0displaye=
d=A0in the node before admission).
How can I stop this logical issue?=
=0ACan i have solution for this?
Thank you in advance.
--0-2061476704-1311229088=:27261--
Re: Next Unique Number - Generation
am 21.07.2011 08:56:57 von Vikram A
--0-1911328395-1311231417=:42357
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Hi Neil,
thank you for your response,=0AThe admission number/register =
number will contain text/symbol(-,/,#). Is it possible to keep this as incr=
ement=A0?
________________________________=0AFrom : Neil Martins =
=0ATo: Vikram A ; MY =
SQL Mailing list =0ASent: Thursday, 21 July 2011 12:=
06 PM=0ASubject: Re: Next Unique Number - Generation
Hi
in ur dat=
abase define the 2 numbers as auto increment.
Neil Martins Exact=
us Corporation Pvt. Limited ISO 9001:2000 certified 1st floor, Raheja Plaza=
, LBS Marg, Ghatkopar (West), Mumbai 400 086 India T: (9122) 66505900 F: (9=
122) 22040826 Url:www.exactuscorp.com -------------------------------------=
------------------------------------------- DISCLAIMER and CONFIDENTIALITY =
CAUTION This email and any files transmitted with it are confidential and i=
ntended solely for the use of the individual or entity to whom they are add=
ressed. Unauthorized reading, dissemination, distribution or copying of thi=
s communication is prohibited. If you are not the intended recipient, any d=
isclosure, copying, distribution or any action taken or omitted to be taken=
in reliance on it, is prohibited and may be unlawful. If you have received=
this communication in error, please notify us immediately by telephone at =
(9122) 66505900 or email us at info@exactuscorp.com and promptly destroy th=
e original communication. Thank you for your
cooperation. Please note that any views or opinions presented in this emai=
l are solely those of the author and do not necessarily represent those of =
the company. Communicating through email is not secure and capable of inter=
ception, corruption and delays. Anyone communicating with Exactus Corporati=
on Limited by email accepts the risks involved and their consequences. The =
recipient should check this email and any attachments for the presence of v=
iruses. Exactus accepts no liability for any damage caused by any virus tra=
nsmitted by this email.=0A----- Original Message ----- From: "Vikram A"
kkiatbipl@yahoo.in>=0ATo: "MY SQL Mailing list" =0AS=
ent: Thursday, July 21, 2011 11:48 AM=0ASubject: Next Unique Number - Gener=
ation
=0AHi there,
I need a technical help fro you,=0AI have deve=
loped a software for college & school. Here we have concept called register=
number/admission number. These are two unique umber for each student. My a=
pplication resides Client/server model.=0AThese numbers will be generated (=
some defined format) to each student when they are admitted at first time. =
This admission process is taken place at different nodes at a time.=0AIn th=
is scenario, I am facing difficulty that, the same number is generated at t=
ime in two machines. (Logic is newest number will be displayed in the node =
before admission).
How can I stop this logical issue?=0ACan i have sol=
ution for this?
Thank you in advance.
--0-1911328395-1311231417=:42357--
RE: Next Unique Number - Generation
am 21.07.2011 21:13:54 von Daevid Vincent
I can think of several ways to accomplish this (or close to it).
* Assign each server a number and prefix/append that number to the =
unique
ID.
* initialize each table on each server at a different huge number so =
they
don't ever collide:
ALTER TABLE `students` AUTO_INCREMENT=3D10000000;
Other server:
ALTER TABLE `students` AUTO_INCREMENT=3D20000000;
* don't re-invent the wheel and just use UUID()
* make the primary key a combination key of a regular auto-increment =
and
NOW() or RAND() or some other unique column of the table itself or =
something
like IP number of the server, etc.
* setup a trigger to alter the primary key accordingly prior to insert.
Maybe one server is even numbers and the other is odd numbers, or use =
MOD()
or other math to have a pool of servers.
http://stackoverflow.com/questions/5416548/mysql-two-column- primary-key-w=
ith
-auto-increment
> -----Original Message-----
> From: Vikram A [mailto:vikkiatbipl@yahoo.in]
> Sent: Wednesday, July 20, 2011 11:18 PM
> To: MY SQL Mailing list
> Subject: Next Unique Number - Generation
>=20
> Hi there,
>=20
> I need a technical help fro you,
> I have developed a software for college & school. Here we have concept
> called register number/admission number. These are =
two=A0unique=A0umber for
each
> student. My=A0application=A0resides Client/server model.
> These numbers will be generated (some defined format) to each student =
when
> they are=A0admitted at first time. This admission process is taken =
place at
> different nodes at a time.
> In this=A0scenario, I am facing=A0difficulty that, the same number is
generated
> at time in two machines. (Logic is newest number will =
be=A0displayed=A0in the
> node before admission).
>=20
> How can I stop this logical issue?
> Can i have solution for this?
>=20
> Thank you in advance.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg
Re: Next Unique Number - Generation
am 22.07.2011 17:47:53 von prabhat kumar
--bcaec51a8e567adbb404a8aa636d
Content-Type: text/plain; charset=ISO-8859-1
Assign each server a number and prefix/append that number to the unique
> ID.
>
I will suggest you above, append -A for first machine and -B for
second machine.
-Prabhat
On Thu, Jul 21, 2011 at 12:13 PM, Daevid Vincent wrote:
> I can think of several ways to accomplish this (or close to it).
>
> * Assign each server a number and prefix/append that number to the unique
> ID.
> * initialize each table on each server at a different huge number so they
> don't ever collide:
> ALTER TABLE `students` AUTO_INCREMENT=10000000;
> Other server:
> ALTER TABLE `students` AUTO_INCREMENT=20000000;
> * don't re-invent the wheel and just use UUID()
> * make the primary key a combination key of a regular auto-increment and
> NOW() or RAND() or some other unique column of the table itself or
> something
> like IP number of the server, etc.
> * setup a trigger to alter the primary key accordingly prior to insert.
> Maybe one server is even numbers and the other is odd numbers, or use MOD()
> or other math to have a pool of servers.
>
> http://stackoverflow.com/questions/5416548/mysql-two-column- primary-key-with
> -auto-increment
>
>
> > -----Original Message-----
> > From: Vikram A [mailto:vikkiatbipl@yahoo.in]
> > Sent: Wednesday, July 20, 2011 11:18 PM
> > To: MY SQL Mailing list
> > Subject: Next Unique Number - Generation
> >
> > Hi there,
> >
> > I need a technical help fro you,
> > I have developed a software for college & school. Here we have concept
> > called register number/admission number. These are two unique umber for
> each
> > student. My application resides Client/server model.
> > These numbers will be generated (some defined format) to each student
> when
> > they are admitted at first time. This admission process is taken place at
> > different nodes at a time.
> > In this scenario, I am facing difficulty that, the same number is
> generated
> > at time in two machines. (Logic is newest number will be displayed in the
> > node before admission).
> >
> > How can I stop this logical issue?
> > Can i have solution for this?
> >
> > Thank you in advance.
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=aim.prabhat@gmail.com
>
>
--
Best Regards,
Prabhat Kumar
MySQL DBA
My Blog: http://adminlinux.blogspot.com
My LinkedIn: http://www.linkedin.com/in/profileprabhat
--bcaec51a8e567adbb404a8aa636d--