• Post Reply Bookmark Topic Watch Topic
  • New Topic

create a sequence number by using database  RSS feed

 
sathishkannan kannika
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i like to create a sequence number by using database in format of MICSEST00013 in java as unique id and save in database ,it possible.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why does it need to be in that format? It's much more customary to simply use a semantic-less numeric value as a primary key.
 
Campbell Ritchie
Marshal
Posts: 56578
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I think you have fallen into the trap of thinking, “how do I do it?” rather than, “what should I do?” As Bear has already said, why do you need MICEST as part of your ID? Why can't you use the sequence generation function of the database? Can you use “MICEST” and the number as a composite key? Is “MICEST123” the same as “MICEST00123” or different? What comes after “MICEST99999”?

You need to consider those questions before you can decide how to do anything.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!