Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid object name SQL Server 2008 R2 - Stored procedure

People also ask

What does invalid object name mean?

This typically means 1 of 2 things... you've referenced an object (table, trigger, stored procedure,etc) that doesn't actually exist (i.e., you executed a query to update a table, and that table doesn't exist). Or, the table exists, but you didn't reference it correctly...

How do I save a stored procedure in SQL Server?

To save the modifications to the procedure definition, on the Query menu, select Execute. To save the updated procedure definition as a Transact-SQL script, on the File menu, select Save As. Accept the file name or replace it with a new name, and then select Save.


It's SSMS, not SQL Server. If it's an error against the database engine you'll know it (it wouldn't execute the command successfully).


Solution

You need to refresh the Intellisense cache (Ctrl + Shift + R). Or you can go to Edit -> IntelliSense -> Refresh Local Cache.


Create a stored procedure by using CREATE PROCEDURE, not ALTER PROCEDURE.


Intellisense doesn't refresh as quickly as you create new objects. You need to refresh the cache (Ctrl + Shift + R). Or, maybe, don't rely on Intellisense and only worry if the execution fails.