Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
EJB 3 in Action
this week in the
EJB and other Java EE Technologies
Generating primry keys
Joined: May 15, 2007
Jun 02, 2007 20:41:00
Friend How can I create unique primary keys in
or in mysql.
Please read this...........
There are lot of speed posts(type of mail/letter) are accepted in our postoffices. I need to uniquely identify them. I thought to generate a unique id like this.
Say its 04thJune07 then
the ids will propogate like 040607(a unique post office id - 5 digits)(auto increment letter id)
For example 040607907361
040607 is the date, 90736 is the post office code (there are unique code for every post offices), 1 is the autoincrement no.
Can any body help me?
Author and ninkuma
Joined: Jan 10, 2002
Jun 02, 2007 21:03:00
Please take the time to choose the correct forum for your posts. This forum is for questions on
This post has been moved to a more appropriate forum.
Asking smart questions
Books by Bear
Joined: Nov 18, 2006
Jun 02, 2007 21:53:00
Here's a Google search command that searches the official mysql site for autoincrement within a CREATE TABLE SQL command:
create table autoincrement site:www.mysql.com
I agree. Here's the link:
subject: Generating primry keys
Map Interface on SCJP
Why use a Unique Key when you can use a Primary Key?
reading from a properties file
generate unique fixed length code from a string
help with keylistener
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014