The Bit Bucket

SSMS Tips and Tricks 5-3: Using the XML editor and increasing the XML output size

Most people use SSMS to edit SQL queries. No big surprise there. The files will have a file type of .sql.

But what many people don’t understand is that SSMS inherits many of its underlying Visual Studio’s abilities to edit other document types.

For example, if you open a .txt text file, you can edit it just fine, and you can also include files like this in SSMS script projects. That can be useful for additional notes and documentation.

2025-08-23

Book Review: Getting Started with Graph Query Language (GQL)

Another book that I recently received for review from my friends at PackT Publishing was Getting Started with Graph Query Language (GQL) by Ricky Gun, Jason Zhang, and Yuri Simione.

The subtitle is The complete guide to designing, querying, and managing graph databases with GQL.

I’ve worked with a number of graph-based databases over the years and I was interested to see where GQL is heading.

SQL Server Graph

In 2017, graph databases were all the rage, and so I wasn’t surprised when the SQL Server team decided to implement graph functionality within SQL Server.

2025-08-22

SSMS Tips and Tricks 5-2: Viewing and configuring spatial data output

SQL Server 2008 added the ability to work with spatial data by the additional of the geometry and geography data types. When they first were added, there was no tools support for working with them, and all we had was direct manipulation of their internal binary storage.

Here’s an example:

I’ve defined a variable named @Shape of type GEOMETRY. I’ve then assigned a shape to it, based on a polygon formed by a set of points. If you look carefully, you’ll notice that it’s a square.

2025-08-21

SQL Interview: 72 Dynamic data masking and encryption

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: Development Level: Advanced

Question:

Is dynamic data masking a form of encryption?

Answer:

No. Dynamic data masking just obfuscates the data when it is presented to end users. It is unrelated to encryption.

Obfuscation is not a form of encryption.

2025-08-20

SSMS Tips and Tricks 5-1: Changing the number of rows selected or edited in Object Explorer

When you right-click a table in SQL Server Management Studio, you get options for selecting or editing but the number of rows is limited:

Those values can be changed. By default, these numbers are both 200, but I’ve decided to change the default number of rows selected to 1000.

In Tools, Options, SQL Server Object Explorer, then Commands, you can set the values to whatever suits you:

I don’t tend to ever use the Edit option but I’d suggest not making it too large.

2025-08-19

SQL: The need for enumerations in T-SQL

I recently wrote about the need for T-SQL to have constants. I received a lot of feedback on that.

Everyone seemed to agree, although one or two asked Why bother as Microsoft isn’t really listening now about enhancing T-SQL?. I understand that sentiment but I don’t think things are quite as bleak as some are suggesting. I currently sense a stirring within the product group, where there is a new interest in developers.

2025-08-18

SSMS Tips and Tricks 4-10: Using Activity Monitor

This is a quick tip but an important one. I see many people using SSMS and they aren’t aware of Activity Monitor.

While there are many clever things that we can do with queries, to interrogate the health of the system, don’t forget that there is quite a bit of useful information in Activity Monitor, and it’s easy to get to.

There are two basic ways to launch Activity Monitor. The first is to right-click the server in Object Explorer:

2025-08-17

SQL Interview: 71 Potential issues with NOLOCK

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: Administration Level: Advanced

Question:

You have applications that make extensive use of NOLOCK hints. You have heard that this can cause issues.

Which of the following issues could occur as a result of using NOLOCK hints?

  • Duplicate rows
  • Phantom rows
  • Missing rows

Answer:

2025-08-16

SSMS Tips and Tricks 4-9: Setting SQLCMD mode for all new query windows

SQLCMD mode changes how queries are executed in SSMS. When using this mode, you can work with options that aren’t normally part of SQL Server T-SQL scripts.

Some installation scripts also require SQLCMD mode and will fail if it’s not enabled.

Let’s look at an example executing a query against 2 servers within the same script.

First, we open a new query window, then on the Query menu, we choose SQLCMD Mode.

2025-08-15

SQL: The need for constants in T-SQL

If you look at the code in the image above, I have one immediate reaction.

What are those numbers that are sprinkled throughout the code?

I see this all the time in T-SQL code. Yet in any programming language, it’s a really poor idea to do this. It leads to very fragile code that’s so hard to maintain longer-term.

So why do people do it?

So, you might wonder why people do this in T-SQL. Couldn’t they just do this at the start of the code?

2025-08-14