Category Archives: T-SQL

  1. Why you should never use default string lengths.

    Leave a comment

    March 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

  2. DROP IF EXISTS

    Leave a comment

    March 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

  3. Set a variable and update a column at the same time.

    11

    February 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

  4. Error message: http://System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting the varchar value ‘NULL’ to data type int.

    7

    December 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

  5. The curious case of CHAR(0)

    10

    November 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

  6. SQL Homework – October 2019 – Code review (self and peer)

    Leave a comment

    October 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

  7. When were the statistics last updated and how many rows were sampled?

    Leave a comment

    September 4, 2019 by Kenneth Fisher

    TL;DR; Final query is at the bottom. Every now and again (particularly when someone is having performance problems) I’ll get …
    Continue reading

  8. Setting Trigger Order

    Leave a comment

    August 26, 2019 by Kenneth Fisher

    If you can help it you probably shouldn’t be using triggers. But if you have to use a trigger you …
    Continue reading

  9. Why do DBAs dislike loops?

    5

    August 22, 2019 by Kenneth Fisher

    If you started out as a developer you were probably taught how important loops are. They are one of the …
    Continue reading

  10. Constructing a datetime from an integer date and an integer time.

    4

    August 15, 2019 by Kenneth Fisher

    Occasionally I’ve seen date and time stored separately as integers. This had some practical applications back before we had date …
    Continue reading

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 3,106 other followers

Follow me on Twitter

ToadWorld Pro of the Month November 2013