Azure-Sql-Db

SSMS Tips and Tricks 1-13: Database scoped configurations UI

The SQL Server team has been working towards making databases more standalone, and less dependent on the server, for quite a while. SQL Server 2012 was the first version that had a concept of a contained database. The thinking was that you should be able to move databases around to different servers and, in that case, users would follow with the database because they didn’t have a dependency on logins, which was the case up until then.

2025-11-11

Echoes from the field 6: Controlling stored procedure execution context (Part 2)

This second article in a two-part series shows you how to control the execution context of stored procedures. This time, it’s by using digital signatures and code signing.

During a recent consulting engagement, I noticed that the client needed to control the security context a stored procedure was running under but was using a convoluted method to do so. Changing the security context that stored procedures run under is a common requirement, letting users execute code via stored procedures that they aren’t allowed to execute directly.

2025-11-10

SSMS Tips and Tricks 2-14: Grid results border colors

As soon as I started working with a recent version of SSMS, I realized that I didn’t like how heavy the grid lines were in the output:

I really wanted the data to be the focus, not the lines. They seemed much darker than on the previous versions. Note that this is a personal preference. I can imagine some people preferring them as they now are. Fortunately, though, you can now change the color of the lines. In Tools, Options, Fonts and Colors, in the Grid Output section, there is now an entry for Grid Results Lines.

2025-11-07

Echoes from the field 5: Controlling stored procedure execution context (Part 1)

This is part 1 of a two-part series that shows you how to use the EXECUTE AS clause to change and control security context for stored procedures. Up next month will be digital signatures.

During a recent consulting engagement, I noticed that the client needed to control the security context that a stored procedure was running under but was using a convoluted method to do so. Changing the security context that stored procedures run under is a common requirement, letting users execute code via stored procedures that they aren’t allowed to execute directly.

2025-11-06

SSMS Tips and Tricks 4-11: Encryption status in query status bar

One of the bigger changes in recent versions of SSMS has been the inclusion of connection encryption details on the main connection page:

Previously, this was on another page of the logon dialog. Once you make the connection though, there previously was no indication of what type of encryption was used. Now that appears in the query status bar as a lock. When you hover over the lock, it shows you the type of encryption that had been selected.

2025-11-04

Echoes from the field 4: Unique indexes vs unique constraints

Uniqueness can be implemented by primary keys, unique constraints and unique indexes. The use of primary keys is well understood but confusion exists about unique constraints and unique indexes.

This issue arose from a consulting engagement I was performing earlier in the month. During one of the architectural discussions I was having with the client, an interesting question was suddenly posed: When would you ever use a unique index?

After thinking about this for a moment, I suddenly realized that I almost never would use one and so I raised the topic on a technical discussion forum. An interesting discussion ensued and I’ve summarized the key thoughts in this article.

2025-11-02

SQL Interview: 90 Truncate table failing

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 trying to truncate a table but the command is failing.

Can you give some examples of what can cause a truncate command on a table to fail?

Answer:

One common reason is that the table is referenced by a FOREIGN KEY constraint. (But you can truncate a table that has a foreign key that references itself).

2025-10-31

SSMS Tips and Tricks 3-18: Scrolling sensitivity

When I’m editing large script files in SSMS, I sometimes find that the scrolling speed of my mouse wheel is too fast or too slow.

If you don’t like the current speed, SSMS has an option to adjust that.

It’s in the Text Editor, Advanced, section. It allows you to control how many lines you get per scroll (for vertical scrolling) or how many characters (for horizontal scrolling):

2025-10-30

SSMS Tips and Tricks 3-17: Intellisense casing for function names

When I write T-SQL, my standard is to use upper-case names for built-in system functions. But not everyone likes that.

I’ve done a lot of work on systems where all these names are lower-case. I don’t have any great objection to that, but it’s painful if Intellisense keeps making them upper-case.

But there is a solution. In Text Editor, Transact-SQL, then Intellisense, there is an option for this:

2025-10-28

SSMS Tips and Tricks 7-15: Disabling the open transaction check

When you close SSMS, the default action is that it checks each open window and makes sure there are no open transactions before it closes.

This is to allow you to decide what to do if you do have an open transaction, and based on that, to avoid losing any work.

While this sounds like a great idea, I mostly now work with Azure SQL Database, and my SSMS windows have been idle for long enough that I’ve lost the connection. So, when I close SSMS, it tries to check the transaction status against connections that are already closed under the covers.

2025-10-26