This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
Two differently textured tenderizer faces making distinct impressions in plain dough

Salted Password Hashes With HASHBYTES and CRYPT_GEN_RANDOM

March 13, 2018
Pinal Dave
SQL Tips and Tricks
SQL Password, SQL Random, SQL Server

A salt makes two identical passwords look different, yet it does not slow down guessing. Here is a small demo of both, and what to use instead.

Read More
Unmarked tokens tumble from a wooden raffle drum

How to Get Random Records from Table? – Interview Question of the Week #105

January 8, 2017
Pinal Dave
SQL Interview Questions and Answers
SQL Function, SQL Random, SQL Scripts, SQL Server

How do you get random records from a table? This interview question never gets old. Here is the ORDER BY method I use because its syntax is easy to remember.

Read More
MySQL - How to Generate Random Number

MySQL – How to Generate Random Number

February 6, 2016
Pinal Dave
SQL Tips and Tricks
MySQL, SQL Random

MySQL’s UUID() function returns a random 36 character value. Here is how to generate random number strings and passwords of any length from it.

Read More
SQL SERVER - Generate Different Random Number for Each Group Using RAND() Function

SQL SERVER – Generate Different Random Number for Each Group Using RAND() Function

April 25, 2015
Pinal Dave
SQL Tips and Tricks
SQL Function, SQL Random

The RAND() function returns the same value for every row in a query. Here is a simple trick to generate a different random number for each group.

Read More
A pebble tumbler holds varied stones while two similar stones lie beside it

Generating Unique, Hard-to-Guess Voucher Codes in T-SQL

December 17, 2013
Pinal Dave
SQL Tips and Tricks
Primary Key, SQL Random, SQL String

Random-looking codes can still be guessed. Build 20 voucher codes from random bytes, check them, and make redemption single-use.

Read More
A glass vase of beans in colored layers, a scoop from the top holding only red beans.

TABLESAMPLE Samples Pages, Not Rows: Sampling a Large Table Right

June 1, 2013
Pinal Dave
SQL Tips and Tricks
SQL Random, SQL Scripts, SQL Server

Compare TABLESAMPLE page sampling with NEWID sorting and CHECKSUM filters by row count, reads, spread, and repeatability.

Read More
Gouache painting of colored beads spilling from a wooden scoop into a shallow brass-railed tray.

Generate Random Values in SQL Server: SQL in Sixty Seconds #042

February 6, 2013
Pinal Dave
SQL Video
SQL Function, SQL in Sixty Seconds, SQL Random, SQL Scripts

To generate random values in SQL Server, pick the function by the job: RAND for one value, CHECKSUM(NEWID()) for a value on every row, CRYPT_GEN_RANDOM for tokens. The tests here count 100,000 draws and show where the common formulas go wrong.

Read More
Previous 1 2 3 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com