
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
- Tweets14.1K
- Following158
- Followers5.1K
- Likes65.3K
RIP Sam Neill.
Great actor, great winemaker, great New Zealander.
Difficult not to take these things unreasonably personally.
4
697
Replying to @CTankie1917 @KyleTrainEmoji
This was a human decision, not autopilot.
From the source thread quoted:
26
Replying to @erikdarlingdata @sqL_handLe
1
2
121
Chat seemed to enjoy this SQL Server query today...
Online demo: dbfiddle.uk/aq6S7pTR
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 @erinstellato @erikdarlingdata
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










