Answer the question
In order to leave comments, you need to log in
How to create a unique id without using a sequence?
the only thing I came up with is to find the maximum value of the column and add one to it. Could you suggest any other ways? (they may not be effective)
Answer the question
In order to leave comments, you need to log in
You don't have to think of anything. GUID (UUID). Look at the wiki. This is the standard. There are also calculation functions for different languages.
Could you clarify the end goal.
If you need to constantly generate, then GUID or UUID, as advised above.
If, say, you need to generate a finite number of identifiers, then go to random.org and row with a shovel.
If, as you say, only numbers, and constantly generate, and even SQL, as you indicated, then I see no other way how to do random and check to exhaustion whether there was already one in the database. Well, or take in advance N, or better M numbers from random.org and insert one from there into the database. I really don't know what will happen when they end ;)
the only thing I came up with is to find the maximum value of the column and add one to it. Could you suggest any other ways? (they may not be effective)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question