Category Archives: T-SQL
-
Negative (-) is an operator and will affect the order of operations.
7May 18, 2020 by Kenneth Fisher
An interesting question came to my attention the other day. A strange operation problem in SQL Server: -100/-100*10 = 0 …
Continue reading -
Explain CROSS APPLY like I’m 5.
5May 11, 2020 by Kenneth Fisher
A good friend of mine (Randolph West (blog|twitter) asked that someone Explain CROSS APPLY like they are 5. So, here’s …
Continue reading -
Is there an easy way to tell what pricing tier my Azure SQL DB/DW is using T-SQL?
3April 22, 2020 by Kenneth Fisher
I ran into an interesting problem today. I needed to find out the pricing tier of an Azure SQL DB …
Continue reading -
What is the datatype SQL_VARIANT
3April 16, 2020 by Kenneth Fisher
The SQL_VARIANT data type is an interesting beast. It is a data type that can store most types of data. …
Continue reading -
Why you should never use default string lengths.
Leave a commentMarch 25, 2020 by Kenneth Fisher
TL;DR; You probably don’t know what you’re going to get. Even if you do know the person maintaining your code …
Continue reading -
DROP IF EXISTS
Leave a commentMarch 23, 2020 by Kenneth Fisher
It’s amazing the things that SQL can do these days. It’s also amazing how many of them I’ve managed to …
Continue reading -
Set a variable and update a column at the same time.
11February 19, 2020 by Kenneth Fisher
The other day I saw a weird option for the UPDATE command in a stack overflow answer. Basically it looked …
Continue reading -
Error message: http://System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting the varchar value ‘NULL’ to data type int.
7December 5, 2019 by Kenneth Fisher
I love this error. Primarily because it demonstrates two very important things. Errors matter. Make sure when you ask someone …
Continue reading -
The curious case of CHAR(0)
12November 14, 2019 by Kenneth Fisher
Over the years I’ve seen quite a few strange things with SQL Server. This one may not have been the …
Continue reading -
SQL Homework – October 2019 – Code review (self and peer)
1October 2, 2019 by Kenneth Fisher
Every database person I’ve ever met writes at least some code at some point in their career. That code might …
Continue reading





