• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inserting 00001 into a table

 
Mahesh Lohi
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What type of database do you use ?

 
Mahesh Lohi
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the quick response. I use mysql.
 
Campbell Ritchie
Sheriff
Posts: 51361
87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you want this to be a primary key with auto_increment properties?
 
Mahesh Lohi
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes if possible. not a prob if that is not possible. I will increment it each time by my self.
 
Evan Caballero
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic