Sql-Server

SQL: Can a table have no columns?

SQL: Can a table have no columns?

One of the things I always tell people that I love about consulting/mentoring work is that you see things that you just can’t make up. They provide interesting material for training classes.

Recently, I came across something that I wasn’t expecting. I was migrating data from DB2 and in my scripts, I had made the presumption that a table would have at least one column. Turns out that in DB2 you can have a table with no columns.

2026-05-24

General: MS Tech Summit 2026 coming in June

General: MS Tech Summit 2026 coming in June

On June 15-16, @MS Tech Summit 2026 is on again! I enjoy this event every year, and have participated for many years.

My session this time is How AI Features Improve Search in SQL Server 2025, and I’ll be discussing how AI-based capabilities in SQL Server have changed the game for search.

Use the code MSTS26SP20 to get 20% off Standard or Exec passes.

See you at MSTS!

Find more details about the event here: https://ml.dssconf.pl/en/

2026-05-23

SQL: Auto-Delete Azure SQL Database Servers with No Databases

SQL: Auto-Delete Azure SQL Database Servers with No Databases

In Azure SQL Database, a database server is a logical concept that’s used to keep details of connected databases. It does have a master database but it’s not like the on-premises equivalent.

It’s pretty much a container for logins. And it won’t let you create objects in it. I wish it would as there is occasionally code that I’d like to store at the server level. An example is code that I use to control scaling of databases from within T-SQL.

2026-05-22

SQL: Making T-SQL Scripts Easier to Read

SQL: Making T-SQL Scripts Easier to Read

When creating tools that script out SQL Server objects, the normal behavior is to quote object names, in case the names wouldn’t otherwise be valid. The problem with that, is that many scripts then become an amazing mess of square brackets that makes the scripts far less readable. And often, there’s no need for the quoting in the first place.

If you avoid things like spaces in object names, you can mostly get away without quoting i.e. Sales.Customers is just fine and doesn’t need to be [Sales].[Customers]. That’s just far less readable IMHO.

2026-05-20

SQL: Is there more to using Azure SQL Database than redirecting your connection string?

SQL: Is there more to using Azure SQL Database than redirecting your connection string?

We work with many customers that are moving some of their applications to cloud-based systems, and mostly on Azure. One message that I often hear about using Azure SQL Database (ASD) is that all you need to do is point your application’s connection string to the cloud and all will be good. While there are occasional cases where that is true, that generally isn’t going to give you a great outcome. And it’s generally very misleading. To really get a great outcome, you generally will need to check out how your application has been designed.

2026-05-18

SQL: SQL Server and Programming Frameworks

SQL: SQL Server and Programming Frameworks

I have days where I can’t decide if I’m frustrated or sad about how I see SQL Server being used by applications, or if I’m happy that this keeps us in ongoing work.

Recently, I was looking at a system that was having performance issues. There were three key applications on the system. Each came from a different vendor and when I looked at how each one of them interacts with the server, it was just really frustrating.

2026-05-16

SQL: ALL_LATEST_FILES option for RESTORE

SQL: ALL_LATEST_FILES option for RESTORE

The default action when performing a backup is to append to the backup file yet the default action when restoring a backup is to restore just the first file. This has never made sense to me.

Apparent loss of data ?

I constantly come across customer situations where they are puzzled that they seem to have lost data after they have completed a restore. Invariably, it’s just that they haven’t restored all the backups contained within a single OS file.

2026-05-10

SQL: Stored Procedure Contracts and Temp Tables

SQL: Stored Procedure Contracts and Temp Tables

I’ve recently been writing about the need for stored procedures to have contracts . Temporary tables add another dimension to that discussion.

Tempory tables are visible within the scope where they are declared but also in sub-scopes. This means that you can declare a temp table in one stored procedure but access it in another stored procedure that is executed from within the first stored procedure.

There are two reasons that people do this. One reason is basically sloppy code, a bit like having all your variables global in a high level programming language. But the more appropriate reason is to avoid the overhead of moving large amounts of data around, and because we only have READONLY table valued parameters.

2026-05-08

SQL: The need for user-defined index types

SQL: The need for user-defined index types

A few days ago, I wrote about SQL CLR and how I don’t normally use it now, but if I did, which types of objects make sense for it. I briefly mentioned user-defined data types but today, I wanted to call out another limitation of these that I’d like to see addressed (if we keep on using SQL CLR).

Early versions of the user-defined data types in SQL CLR had a limitation on size, where they needed to be serializable within 8KB. That limit is now long gone and so the ability to define new data types using SQL CLR integration was now almost at a usable level, apart from one key omission: indexes.

2026-05-06

SQL Down Under show 95 with guest Jess Pomfret discussing Data API Builder for SQL Server

SQL Down Under show 95 with guest Jess Pomfret discussing Data API Builder for SQL Server

It was great to catch up with Jess Pomfret today and to have her on a SQL Down Under podcast.

Jess is a Data Platform Engineer and a dual Microsoft MVP. She started working with SQL Server in 2011, and she says she enjoys the problem-solving aspects of automating processes with PowerShell.

Jess also enjoys contributing to dbatools and dbachecks, two open source PowerShell modules that aid DBAs with automating the management of SQL Server instances.

2026-05-05