UNIQUEID() just a random 32-bit int?

Now that I look at tables with lots of UNIQUEID() generated data, it just looks like a 32 bit int in hex. I might have been misled by the documentation, which says there are “trillions” of possibilities.

If fear of collisions keep you up a night (rational or not), use the “UUID” argument with UNIQUEID() or write your own generator. That’s UNIQUEID(“UUID”). Function that compactly generates a 1 in 53 trillion chance of collision:

=CONCATENATE(
MID(2345679abcdefghjkmnpqrstuvwxyzACDEFGHJKMNPQRSTUVWXYZ,RANDBETWEEN(1,52),1),
MID(2345679abcdefghjkmnpqrstuvwxyzACDEFGHJKMNPQRSTUVWXYZ,RANDBETWEEN(1,52),1),
MID(2345679abcdefghjkmnpqrstuvwxyzACDEFGHJKMNPQRSTUVWXYZ,RANDBETWEEN(1,52),1),
MID(2345679abcdefghjkmnpqrstuvwxyzACDEFGHJKMNPQRSTUVWXYZ,RANDBETWEEN(1,52),1),
MID(2345679abcdefghjkmnpqrstuvwxyzACDEFGHJKMNPQRSTUVWXYZ,RANDBETWEEN(1,52),1),
MID(2345679abcdefghjkmnpqrstuvwxyzACDEFGHJKMNPQRSTUVWXYZ,RANDBETWEEN(1,52),1),
MID(2345679abcdefghjkmnpqrstuvwxyzACDEFGHJKMNPQRSTUVWXYZ,RANDBETWEEN(1,52),1),
MID(2345679abcdefghjkmnpqrstuvwxyzACDEFGHJKMNPQRSTUVWXYZ,RANDBETWEEN(1,52),1))

I got rid of look-alikes such as 0, O, 1, l but you can put them back in and put in other wacky characters (as in UUENCODE) to decrease collision chances.

3 Likes

This should be in the #tips category.