GeeCON Prague 2014*
The moose likes JDBC and the fly likes Inserting 00001 into a table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "Inserting 00001 into a table" Watch "Inserting 00001 into a table" New topic
Author

Inserting 00001 into a table

Mahesh Lohi
Ranch Hand

Joined: Jun 22, 2009
Posts: 150
Hi all,

In one of my application I would want to insert 0000001 into the table.

Once I increment it it should be 0000002. Is this posible.

Thank you in advance

Evan Caballero
Ranch Hand

Joined: Dec 10, 2009
Posts: 59
What type of database do you use ?

Mahesh Lohi
Ranch Hand

Joined: Jun 22, 2009
Posts: 150
Thank you for the quick response. I use mysql.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39044
    
  23
Do you want this to be a primary key with auto_increment properties?
Mahesh Lohi
Ranch Hand

Joined: Jun 22, 2009
Posts: 150
Yes if possible. not a prob if that is not possible. I will increment it each time by my self.
Evan Caballero
Ranch Hand

Joined: Dec 10, 2009
Posts: 59
Ritchie is right, you should set the auto-increment property to true in the column definition of the table you are trying to insert to.
 
GeeCON Prague 2014
 
subject: Inserting 00001 into a table