alevyinroc


Blog Post

Did You Really Name That Default?

Ten years (and a couple jobs) ago, I wrote about naming default constraints to avoid having SQL Server name them for you. I closed with the following statement:

SQL Server...

2026-04-17 (first published: )

405 reads

Blog Post

Presenting Twice in May 2026

I will be presenting my latest session, Documenting Your Work for Worry-Free Vacations, in-person twice in May 2026. With summer vacations coming up, this is a perfect time of...

2026-03-30

38 reads

Blog Post

T-SQL Tuesday #193 - Notes to Self

T-SQL Tuesday is a monthly blog party hosted by a different community member each month. This month, Mike Walsh
(blog) asks us:

Write two short notes to yourself. One to the...

2025-12-29 (first published: )

246 reads

Blog Post

Finding Data Friends

I’ve been enjoying Ben Weissmann (Blog | LinkedIn) & Jess Pomfret’s (Blog | LinkedIn ) weekly program Finding Data Friends for a couple years now, getting to know (by...

2025-10-27

27 reads

Blogs

Automated SQL Server Benchmarking with HammerDB and Docker: A Complete Testing Framework

By

I’m excited to announce the release of a new open-source project that fully automates...

T-SQL Snapshot Backups on Availability Group Secondary Replicas

By

One of my favourite features of SQL Server 2022 was the T-SQL Snapshot Backups....

The Book of Redgate: Hours

By

I have said and written this many times: Redgate Software is the type of...

Read the latest Blogs

Forums

AI Experience Gap that we keep talking about

By Pat Wright

Comments posted to this topic are about the item AI Experience Gap that we...

Squared Values

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Squared Values

I Don't Want To Do XX

By Steve Jones - SSC Editor

Comments posted to this topic are about the item I Don't Want To Do...

Visit the forum

Question of the Day

ORDER BY alias

There is a table tmp_tab:

CREATE TABLE tmp_tab (
id int,
val int
);
INSERT INTO tmp_tab VALUES
(1, 1),
(2, NULL),
(3, 3),
(4, 4),
(5, 5);
You want to order the rows ids by the following expression:
    ISNULL(val, id) + 1
Which of the following queries produces the expected ordering and why? (Select all correct)

See possible answers