The Bit Bucket

SSMS Tips and Tricks 1-2: Controlling quoting when dragging columns

Previously I showed how useful it is to be able to drag columns from either a table or from user-defined table type onto a query window.

But one of the first comments I hear from people who did that is:

I hate all those square brackets. How do I stop that?

The option to do that was added to Tools> Options > SQL Server Object Explorer > Commands:

Bonus points for the team because they also provided us with an option to decide whether schema names are dragged as well. That’s mostly used for tables but also applies to other schema-bound objects like stored procedures.

2025-05-09

SQL Interview: 45 Storing UTF-8 Data

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Developer Level: Intro

Question:

You are writing a function that needs to process UTF-8 data. It takes one input parameter named @ValueToProcess that varies in length.

Which data type should you use for the @ValueToProcess parameter?

Answer:

2025-05-08

SSMS Tips and Tricks 1-1: Dragging all column names from Object Explorer

This is a popular shortcut in SQL Server Management Studio (SSMS) but I continue to be amazed how many people aren’t aware of it.

Object Explorer is a very useful part of SSMS and you can drag pretty much any name that you see in it across to a query window.

You could do the same for each column in the Columns list.

You might also realize that you can hover over the asterisk and see a list of columns:

2025-05-07

SQL Interview: 44 Test for an integer value

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Developer Level: Medium

Question:

You have a value in a variable named @NewValue. The data type is varchar(20).

You want to check if the value in the string is an integer and could be cast to an integer.

2025-05-06

SSMS Tips and Tricks: Overview

Now that I’ve finished posting my T-SQL 101 series, it’s time to start another blog post series.

A few years back, I created a shortcuts series that covered how to use SQL Server Management Studio (SSMS) proficiently. I eventually added that all into a free eBook. It was updated in March 2019.

You can get a copy of it here:

SQL Server Management Studio Tips and Tricks

SSMS version 21 is a huge shift from previous versions, so I thought it was time to revisit all the tips and tricks, to work out what still does or doesn’t work, and to add a bunch of new ones. V21 is based on the 64 bit version of Visual Studio, not the older 32 bit VS partner edition shell.

2025-05-05

SQL Interview: 43 No return value from calling procedure

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Developer Level: Intro

Question:

You want to call a procedure that counts the number of customers in a particular city.

You use the following code:

DECLARE @NumberOfCustomers int;

EXEC dbo.GetNumberOfCustomers 
    @City = N'Brisbane', 
    @NumberOfCustomers = @NumberOfCustomers;

SELECT @NumberOfCustomers;

No matter which city name you pass in the code, the selected count is NULL.

2025-05-04

Book Review: Structured Computer Organization (6th Edition)

Over the years, I’ve spent quite a bit of time teaching core computing concepts. When I was teaching at universities, there were a few “go-to” books that I liked to use. One such book was Structured Computer Organization by Andrew Tanenbaum and Todd Austin. I recently noticed that it was now in its 6th edition, so I thought it was time to revisit it.

The book was designed to be used in university courses. I’m not sure what the current setup is, but I noticed on Amazon that it was a crazy high price, yet it was also available for direct download from a university GitHub repository. I couldn’t seem to work out if that was intentional or not, so I won’t link to it.

2025-05-03

SQL Interview: 42 OPTION LABEL

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Developer Level: Medium

Question:

You have a series of very similar SQL queries in an application.

You notice that one of them includes an OPTION LABEL clause.

What would this be used for?

Answer:

OPTION LABEL allows you to apply a label to an instance of a query. That then makes it easy to trace executions of the query using tools like Extended Events or SQL Server Profiler.

2025-05-02

SDU Tools v25 is now available for download

Just a heads-up that v25 of SDU Tools went out to SDU Insiders last week. If you haven’t used SDU Tools, they are just a large library of functions implemented in T-SQL. You can use them as a full library or use them as examples of code in work you are trying to do.

Backwards Compatibility

We’ve also tried to keep all the code working for all versions of SQL Server that we see clients using. That means from SQL Server 2008 to SQL Server 2022. We also have an Azure SQL DB version.

2025-04-30