For this week’s What If series, we’re exploring what would happen if you had access to SQL Server’s source code – like if you got a job at Microsoft, signed a partner NDA, if the code leaked, or if it went open source.
Today’s question is, “What would you look at first?”
Brent says: I’d look at the trace flags list.
Trace flags are switches you can use to flip features on & off. Erik’s compiled a list of known trace flags (and whether or not you should freak out when you see them enabled.) It’s a fun read.
But I’m sure it’s not complete, and I’m sure there’s many that Microsoft would rather never see the light of day again. You know how it is – you’ve got a specific problem you have to solve for a specific customer, and there’s just no other choice than to hard-code something into the engine itself.
I don’t want to use those, mind you.
I just wanna see what they are because I’d get a chuckle out of it.
So I’d go looking for any instance in source that checks for the existence of a trace flag, and then go read the comments. I bet there’s some swearing in there.
Erik says: I’d stare my enemy in the face
Why do they do such awful things?
Did they do something wrong in a past life?
This has been a big issue in SQL Server for many years, and it doesn’t seem to be changing anytime soon.
Unfortunately, there are some things that you can only do with scalar valued functions. You can’t use iTVFs or MSTVFs in computed columns, because they’re not guaranteed to only return one value.