SQL Server Error 208: Invalid Object Name
Msg 208, Level 16, State 1, Line 1 Invalid object name 'Employees'.
What is SQL Server Error 208?
SQL Server Error 208 occurs when a query references a table, view, stored procedure, or other database object that does not exist in the current context. The object may not exist, be in a different schema, or require full three-part naming.
Common Causes
- 1
Table does not exist in the current database
- 2
Wrong schema prefix — default schema is dbo: use dbo.Employees, not just Employees
- 3
Connected to wrong database — USE correct_database
- 4
Typo in object name — SQL Server is case-insensitive by default but spelling must match
- 5
Temporary table (#temp) referenced outside the creating session/procedure scope
- 6
Missing three-part name for cross-database reference: database.schema.table
Step-by-Step Solutions
Verify object exists: SELECT * FROM sys.objects WHERE name = 'ObjectName';
Check current database: SELECT DB_NAME();
Use full qualified name: USE database; SELECT * FROM dbo.tablename;
For cross-database: SELECT * FROM OtherDB.dbo.tablename;
Check temp table scope — #temp tables are session-scoped; ##temp are global
Run pending migrations if this is an application object
Prevention Tips
Always use schema-qualified names: dbo.TableName
Use database migrations (Flyway, Liquibase, EF Migrations) with version control
Add USE statements at the top of scripts to explicitly set context
Test scripts in lower environments before production deployment
Frequently Asked Questions
What does Invalid Object Name mean in SQL Server?
What is a schema in SQL Server?
Related Errors
Still Stuck?
Ask our AI SQL Assistant or the community — get answers in seconds.