James Serra's Blog

Blog Post

Azure IoT Central

This is a short blog to give you a high-level overview on a product called Azure IoT Central. I saw this fairly new Azure product (GA Sept 2018) in...

2022-04-11 (first published: )

190 reads

Blog Post

Microsoft industry clouds

In talking with Microsoft customers, I have found that most are not aware that Microsoft has created industry clouds (see Microsoft Industry Clouds). So I wanted to use this...

2022-01-28 (first published: )

178 reads

Blog Post

Distributed SQL

A very brief history of databases for online transaction processing (OLTP) workloads starts with relational databases (RDBMS), which worked well for many years. With the advent of the internet and...

2022-01-07 (first published: )

542 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

ORDER BY alias

By aniap

Comments posted to this topic are about the item ORDER BY alias

Optional Parameter Plan Optimization in SQL Server 2025: Fixing the Kitchen-Sink Search Procedure

By vgupta

Comments posted to this topic are about the item Optional Parameter Plan Optimization in...

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...

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