I intend to be using a
UNIQUEIDENTIFIER as an access key that users can use to access certain data. The key will act as a password in that sense.
I need to generate multiple such identifiers as part of an
INSERT...SELECT statement. For architectural reasons I want to generate the identifiers server-side in this case.
How can I generate a securely random
UNIQUEIDENTIFIER? Note, that
NEWID would not be random enough as it does not promise any security properties at all. I'm looking for the SQL Server equivalent of System.Security.Cryptography.RandomNumberGenerator because I need unguessable IDs. Anything based on
GETUTCDATE would also not qualify.