Monthly Archives: August 2018

Why does the query throw NULL and Schrödinger’s cat?

By | August 23, 2018

An interesting problem came up in #SQLHelp today. The query is fairly simply and aims to generate a random distribution of value 1,2 and 3. I am not sure of the use case for it but this is what the code tries to achieve. [codesyntax lang=”tsql”] select choose(abs(checksum(newid()))%3+1,1.0,0.6,0.3) [/codesyntax]     When the above block… Read More »

The use of table valued parameters and its performance impact – analysis

By | August 3, 2018

I read a very informative post today on Linkedin about how developers sometime don’t understand the impact of using table valued parameters in a stored procedure. A table valued parameter allows developers to pass an array or table in one call to a stored procedure. So it’s basically passing a table as the input. The… Read More »