generate numbers

External Article

Generating Random Numbers in SQL Server Without Collisions

  • Article

From time to time, I see a requirement to generate random identifiers for things like users or orders. People want to use random numbers so that the "next" identifier is not guessable, or to prevent insight into how many new users or orders are being generated in a given time frame, but they don't want to run into any duplicates. We can trade a bit of disk space and relatively predictable (but not optimal) performance for the guarantee of no collisions, no matter how many random numbers we've already used.

2013-09-27

3,852 reads

Blogs

Solving SQL Server Mysteries with a Whole Gang of Sleuths -Scooby Dooing Episode 4

By

One thing I’ve always loved about the Scooby-Doo cartoon is that he never solved...

SQL Server Availability Groups

By

Flexibility and Scale at the Database Level When SQL Server 2012 introduced Availability Groups...

Modify Power BI page visibility and active status with Semantic Link Labs

By

Setting page visibility and the active page are often overlooked last steps when publishing...

Read the latest Blogs

Forums

Password Guidance

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Password Guidance

Using table variables in T-SQL

By Alessandro Mortola

Comments posted to this topic are about the item Using table variables in T-SQL

Azure elastic query credential question

By cphite

I am trying to check out elastic query between two test instances we have...

Visit the forum

Question of the Day

Using table variables in T-SQL

What happens if you run the following code in SQL Server 2022+?

declare @t1 table (id int);

insert into @t1 (id) values (NULL), (1), (2), (3);

select count(*)
from @t1
where @t1.id is distinct from NULL;
 

See possible answers