Sql-Server

SSMS Tips and Tricks 2-4: Presentation mode

I spend a lot of time delivering presentations of various types. Many of those presentations involve showing code in either SQL Server Management Studio (SSMS) or Visual Studio (VS).

I’ve become quite fast at taking a default setup of SSMS and changing it to the fonts, etc. that I want to use for a presentation. Given how large these fonts are, I don’t want to use them for day-to-day work.

2025-06-08

SSMS Tips and Tricks 2-3: Import and Export settings

Whenever I need to work on a new laptop or server, or whenever I change versions of SQL Server Management Studio, I kick myself for not remembering to export my settings, so I can import them again.

I spend quite a bit of effort getting SSMS configured the way I want, so it only makes sense to save the settings. Saving them isn’t perfect but it’s far better than not having done it.

2025-06-06

SQL Interview: 53 Dynamic SQL and Ownership Chaining

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

Question:

You have a table named Sales.Customers that is owned by dbo. You also have a stored procedure named Sales.FindCustomers that searches the Sales.Customers table.

A user Terry is given permission to the procedure and can successfully execute the procedure.

2025-06-05

SSMS Tips and Tricks 2-2: Changing displayed status bar values

The status bar at the bottom of a query window in SQL Server Management Studio contains a wealth of information in its default configuration. The bottom left shows the connection state:

And the bottom right shows quite a bit:

In this case, it’s showing me that I’m connected to a server (local)\SQL2022; it’s running v16 of SQL Server (ie: SQL Server 2022); I’m logged on as GREG7680\Greg; my SPID (or session ID) is 88; and I’m connected to the WideWorldImporters database.

2025-06-04

SSMS Tips and Tricks 2-1: Environment fonts

I’ve been very lucky over the years because I haven’t needed to wear glasses. Every now and then I purchase a pair because I thought it might help with reading. Once I get them though, I find them more inconvenient than helpful and stop using them. I’ve am long-sighted in one eye and short-sighted in the other. That’s turned out to be a really useful thing in day to day life.

2025-06-02

SQL Interview: 52 Deleting duplicated rows

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

Question:

You have an ETL process that loads employee details into a table named Staging.Employees. The table has the following columns:

  • EmployeeID (int)
  • FullName (nvarchar(100))
  • LoginName (varchar(100))

The table is a heap and has no primary key.

2025-06-01

SSMS Tips and Tricks 1-12: Custom report creation

The built-in reports in SQL Server Management Studio are great but you can add your own as well. SQL Server 2005 and later have an option for Custom Reports. Let’s create a report that shows the use of deprecated data types. We’ll use a stored procedure from our free SDU Tools to do that. In SQL Server Data Tools, create a new Report Server project.

Give the project an appropriate name and location, then click Create.

2025-05-31

SQL: What is Halloween protection?

If you’ve worked with SQL Server (or with databases in general) for any length of time, you will have heard someone refer to Halloween protection.  It refers to a problem where update operations could inadvertently end up modifying a row more than once.

Why halloween?

The name Halloween protection comes from when the problem occurred during research on the System R project at the IBM Almaden Research Center back in 1976.

2025-05-30

SSMS Tips and Tricks 1-11: Built-in standard reports

SQL Server Management Studio provides a large amount of information about databases by letting the user navigate around Object Explorer and view the properties of objects.

What I’m often surprized by though, is the number of users who haven’t ever explored the reports that are available. In another section, we’ll look at creating custom reports, but there is a wonderful set of built-in standard reports that you should explore. For example, if I right-click the WideWorldImporters database, I can see these reports:

2025-05-29

SQL Interview: 51 Truncating datetime values to the minute

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 are creating a view in a SQL Server based data warehouse.

You need to query transactions that include a TransactionDateTime column which uses the DateTime data type. The query is as follows:

2025-05-28