Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

auto_increment in mySql

 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

is there any way to auto_increment backwards (-1, -2, -3) in mysql?
or to have an ID which increments like this:
J193
J194
J195
j196

etc?
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think this is possible within MySQL, or any other DB that I know of. If you are using hibernate you could write your own id generator. Otherwise I think you would have to lock the table, query for the last id, then generate the next one all in your java code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic