Home > Software engineering >  SQL Server databases tables exist, but are not visible
SQL Server databases tables exist, but are not visible

Time:03-15

I have an odd issue on a Microsoft SQL Server that I manage. Two of the largest tables in a database are not visible in the Object Explorer.

When doing Right Click > Tasks > Shrink > Files, on the database, it is showing the data file as 99% unused. However in the following screenshot it is clear that there's over 500GB used:

sys.database_files shows over 500GB used

The disk usage by table shows these two tables have over 1B records and is the majority of space reserved in the data file.

Disk Usage by Table

However, when looking in the object explorer, the tables does not exist:

See example here for the AccountHistory Table

I know the table exists because I am able to run select queries against it. The SQL Server version is Microsoft SQL Server 2019 (RTM-GDR) Standard Edition (64-bit). I am also using a sysadmin account, and have confirmed that it is not a view.

Any idea what could be causing this?

Cheers,

CodePudding user response:

It looks to me like you have temporal tables in your environment. The history table will show up underneath the base table in SSMS. Here's a screenshot from the WideWorldImporters sample database from MS:

enter image description here

  • Related