Each database its own unique generator

Share this post:

Don’t you love that every major database on the planet thinks that we (as in developers) don’t need to have a common syntax and that we should spend hours looking for the needed functionality?

Well, it just so happens that I was in need for generating a unique ID today with the database function – also know as UUID. A UUID is a string that is unique and looks something like “0302B2FE-8046-45D1-AB584481D0F2A99E”.

So, without further due here are the different functions for:

[code]SELECT uuid() FROM …[/code]

[code]SELECT newid() FROM …[/code]

[code]SELECT generate_unique() FROM …[/code]

[code]SELECT sys_guid() FROM …[/code]

[code]SELECT random_uuid() FROM …[/code]

Yep, that’s right. Each function is named completely different, so it was not so easy to find them as quickly as I thought. In any case, hope this helps.

Over 10 years in business.

Self-funded. No investors. No bullshit.

More than 3,000 customers worldwide.

Helpmonks - no bullshit customer engagement service

Growth starts with action

Empower your team and delight your customers.

Helpmonks - email management for small businesses