Paul White (@SQL_Kiwi) header
Paul White (@SQL_Kiwi) profile picture

I live in Aotearoa New Zealand and write about SQL Server internals at https://nitter.cf/t.co/nuZwOWQzHy Microsoft MVP 2011-2022 DBA Stack Exchange Mod 2015-2025

Paraparaumu, New Zealand
Joined April 2010
RIP Sam Neill. Great actor, great winemaker, great New Zealander. Difficult not to take these things unreasonably personally.
4
697
This was a human decision, not autopilot. From the source thread quoted:
26
Replying to @BLACKCAPS
Kent, Clark Kent
1
34
6,453
The famous Russian philosopher Эрик Дарлинг contemplating the deeper meaning of a right merge join
2
1
12
512
Chat seemed to enjoy this SQL Server query today... Online demo: dbfiddle.uk/aq6S7pTR
2
2
20
1,330
Replying to @erikdarlingdata
I already bought this issue. Twice.
1
1
47
Replying to @chad_baldwin
Interestingly, though those T-SQL language elements are indeed syntactic sugar for CASE expressions, at a deeper level within the query processor, the more fundamental operator is the scalar operator ScaOp_IIF. From that point of view, you could say IIF was the lowest level, since T-SQL CASE is implemented as 'IIF'. Example (with no FROM clause, for fun): SELECT CONVERT(sql_variant, COALESCE(FILE_IDEX(N''), -1)) OPTION (QUERYTRACEON 3604, QUERYTRACEON 8605); SSMS messages tab output: LogOp_Project COL: Expr1000 LogOp_ConstTableGet (1) [empty] AncOp_PrjList AncOp_PrjEl COL: Expr1000 ScaOp_Convert sql_variant,Null,Var,ML=8016 ScaOp_IIF int,Null,ML=4 ScaOp_Comp x_cmpIsNot ScaOp_Intrinsic file_idex ScaOp_Const TI(nvarchar collate 872468488,Var,Trim,ML=2) XVAR(nvarchar,Owned,Value=Len,Data = (0,)) ScaOp_Const TI(int,Null,ML=4) XVAR(int,Not Owned,Value=NULL) ScaOp_Intrinsic file_idex ScaOp_Const TI(nvarchar collate 872468488,Var,Trim,ML=2) XVAR(nvarchar,Not Owned,Value=Len,Data = (0,)) ScaOp_Const TI(int,ML=4) XVAR(int,Not Owned,Value=-1)
1
7
92
Replying to @erikdarlingdata
All the rage on YouTube, I'm told youtube.com/watch?v=e8EzsOZz…
1
1
336
This is quite a list! Anyway, looking forward to Dork Mode (ha) and the return of the T-SQL Debugger in SSMS 21.
2
3
339