How to list all tables in a MS SQL Server with the date/time it was created

Steve Sohcot
Jan 3, 2024

--

I imported data from Excel into my MS SQL Server database. When I went to query the newly created table, it wasn’t there.

I either typed in the name wrong, or I imported it into the wrong database.

My first step was Gooling this:

“sql server list all tables and when they were created”

The first few results didn’t have what I needed. ChatGPT to the rescue!

Here’s the SQL:

SELECT 
t.name AS TableName,
o.create_date AS CreationDateTime
FROM
sys.tables t
INNER JOIN
sys.objects o ON t.object_id = o.object_id
WHERE
o.type = 'U'
ORDER BY
o.create_date DESC

Where Did I Go Wrong?

As it turns out, I imported in the new table as temp_data instead of data_temp

--

--

No responses yet