Sometimes I’ll go into Starbucks and order an Iced Personal Half-Caff Quad Venti Extra-Vanilla Nonfat One-Sugar Two-Honey With-Whip No-Foam Latte, just to see what kind of reaction I get. (Seriously… I really do).
The vast majority of baristas will stare back at me with a vacant expression and say, “Er… Whu-ut?” Some will just smile or laugh out loud, knowing I’m just kidding around. But on rare occasions, a barista will come right back at me without batting an eyelash and ask with all seriousness, “Do you want a Petite Reduced-Fat Cinnamon Old-Fashioned Zucchini-Walnut Muffin with that?”
They aren’t as much fun.
SQL Server is kind of like that type of barista. It’s not fun trying to get a reaction out of SQL Server. It’s hard to trip it up. The other day, for kicks, I wrote up an obnoxious, impossible-to-understand query (see below), and SQL processed it without question. Occasionally, I think it’d be kind of cool for SQL to be in on the joke and come back with a message saying, “Oh, come ON… Get real!”
/* Initialize */
if object_id('tempdb..#from') is not null drop table #from;
/* The 'mischief' query: */
with [top] as (select [top]=100),[where](
select top (select [top] from [top])
percent [percent] as [as], [sum]=sum ([over]) over(
partition by [partition],[by]),
[into] into #from from [where] where
[order]=[by] order by [order],[by],