mercredi 23 décembre 2020

SQL Server : unique default values

I have a table with a column of type nchar(16) that is automatically filled with random characters generated by setting the default value of the column to dbo.randomtext((16)) (a scalar function). There will be about 1M records in the table.

I know that the likelihood of getting non-unique values is low, but is there some way to ensure that this does not happen and the column is really unique?

What will happen if I define the column as UNIQUE and the random text generated is not unique?

I am using SQL Server 2016 Standard edition.




Aucun commentaire:

Enregistrer un commentaire