Azure-Sql-Db

SSMS Tips and Tricks 3-11: Using bookmarks

In a previous post, I was discussing how outlining can be helpful with navigating around within a large T-SQL script file.

If you were trying to do that within a Microsoft Word document, the most common thing to use is bookmarks, and SQL Server Management Studio (SSMS) has them as well.

Bookmarks are simply placeholders within a script. (They can also apply to other types of document within SSMS). Where I find them very useful is when I’m working in two or three places within a long script at the same time. Perhaps I’m working on a function, and also on the code that calls the function. By using bookmarks, I’m not flipping endlessly around the script file, and can jump directly from placeholder to placeholder.

2025-07-18

SSMS Tips and Tricks 3-10: Using code outlining

For some years now, SQL Server Management Studio (SSMS) has had the ability to use code outlining, the same way that other Visual Studio languages can.

This can be very useful when you are trying to navigate around a large script file.

The simplest usage is to collapse or expand a region of code. Note that in the following script, code regions have been automatically added by SSMS:

This allows us to click on the outline handles, and collapse the code:

2025-07-16

SQL Interview: 63 Keys contained in certificates

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: Security Level: Medium

Question:

Public key encryption is based on combinations of private keys and public keys.

When you install a certificate on a SQL Server, to be used for client connection encryption, which key or keys are contained in the certificate?

2025-07-15

SSMS Tips and Tricks 3-9: Using the clipboard ring

Two key combinations used by SQL Server T-SQL developers every day are Ctrl-C and Ctrl-V for copy and paste.

But many users of SQL Server Management Studio (SSMS) don’t realize that it has a clipboard ring and can deal with several objects in the clipboard at the same time.

Let’s see an example.

In this screen shot, I’ve opened a query window with the source code of the AnalyzeTableColumns procedure from SDU Tools.

2025-07-14

SSMS Tips and Tricks 3-8: Selecting and modifying rectangular regions

I often see people doing very repetitive editing tasks that could easily be carried out by using selecting and changing rectangular regions of code.

The simplest example of doing this is to insert some text on a number of rows. Take the following code as an example:

I’ve got the skeleton of a list of columns in a CREATE TABLE statement but let’s assume that I’m a comma in front person and want to put a few spaces and a comma, etc. in front of each column after the second.

2025-07-12

SQL Interview: 62 Selecting rows for a date

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: Intro

Question:

You have a table of transactions. You need to select all the transactions for a particular date, based on the TransactionDateTime column. It holds datetime data type value. The date is stored in the @RequiredDate variable.

2025-07-11

SSMS Tips and Tricks 3-7: Replace tabs with spaces and do macro-like work using regular expressions

A request that I hear all the time, is “I don’t like tabs but insert name of annoying colleague here decided he likes to use them. How do I remove them?” Similar thing happens when installing SSMS and leaving the default options.

Tabs vs Spaces

Whether to use tabs or spaces leads to near religious level arguments amongst SQL developers. I see strong arguments on both sides. In the past, I’ve always ended up using spaces because I’ve run into issues with tabs in some of the tooling that I needed to use.

2025-07-10

SSMS Tips and Tricks 3-6: Manually prompting for and refreshing Intellisense

Intellisense is one of the best things that’s ever been added to Visual Studio or to SQL Server Management Studio (SSMS). It’s hard to remember back to before it was added, or how we worked then.

I had a young friend from the United Kingdom who had just completed a Computer Science degree and one of the things that he was most proud of, is that he knew so many HTML tags and which attributes went with which tags. When I showed him HTML Intellisense in Visual Studio, I think he was about to cry.

2025-07-08

SQL Interview: 61 Effects of AUTO_CLOSE

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: Medium

Question:

You are reviewing database settings for a server.

You notice that one database has AUTO_CLOSE configured. Your model database does not have it enabled.

What is the most likely cause for that setting to be enabled, and what effect does enabling it have?

2025-07-07

SSMS Tips and Tricks 3-5: Fixing or improving the online documentation

I mentioned in an earlier post that I think the online documentation is now superior to any version that you can install locally.

I particularly like the way that the online version is cross-version ie: each page covers all supported versions, instead of having a separate page for each version.

But one of the really big bonuses is that you also have the opportunity to change the documentation if you think it’s incorrect or you think it could be improved. Microsoft have placed all the documentation in a GitHub repository and you can change it. Doing so is easier than you might expect.

2025-07-06