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.

I can only imagine that comes from creating a table then dropping all the columns. I wondered if SQL Server would do the same, so it was time to find out.

USE tempdb;  
GO

CREATE TABLE dbo.TableWithNoColumns  
( 
    FirstColumn int,  
    SecondColumn int  
);  
GO

ALTER TABLE dbo.TableWithNoColumns DROP COLUMN SecondColumn;  
GO

ALTER TABLE dbo.TableWithNoColumns DROP COLUMN FirstColumn;  
GO

It doesn’t allow this. It won’t let you delete the last column. The following message is returned.

Msg 4923, Level 16, State 1, Line 2

ALTER TABLE DROP COLUMN failed because ‘FirstColumn’ is the only data column in table ‘TableWithNoColumns’. A table must have at least one data column.

That’s fascinating.

When I’m working with semantic models in Analysis Services, Fabric, or Power BI, I can create a table with no columns. I often do that as an anchor point for attaching measures later. The downside with Power BI is that it automatically hides tables with no columns. I wish it didn’t.

But I’d never really thought about having a table without columns in SQL Server. I can understand why they might have thought that was necessary but I’m not so sure. The more I think about it, the more I can imagine scenarios that are similar to what we do with semantic models, where I want to create a table, set up permissions, etc. yet not have columns (yet). I might want to leave a place to add them later. With SQL Server though, it’s hard to imagine why I’d do that without wanting to at least have a simple primary key column on the table.

2026-05-24