How to Resolve a Missing Object in SSMS — Error “Invalid Object Name”(Msg 208 Level 16)

Steve Sohcot
2 min readSep 21, 2023

--

In SQL Server Management Studio, I got the following error:

Msg 208, Level 16, State 1, Line 1

Invalid object name ‘dbo.Users’.

I can clearly see that the table is there:

The Solution

The default database you’re using in SSMS may not be the database you need. In the screenshot above and below, I’m using the database called “master” (as indicated by the dropdown next to the Execute button).

The SQL query didn’t specify a database. It only specified the schema (“dbo”) and table name (“Employees”).

It was looking for the table in the wrong database. It was incorrectly looking in the database called “master”.

Once you specify the database in the SQL query, you’ll get results:

The Take Away

It’s a best practice to explicitly specify the database that you’re using in a SQL query in addition to the tables.

--

--

No responses yet