I am new to SQL Server and created my very first stored procedure. It executes fine and I can locate it under ‘Programmability’, ‘Stored Procedures’ so I pop open a new query and type in the following statements:
use name_of_database
exec name_of_stored_procedure 'value'
However before executing the stored procedure, the name of the stored procedure is underlined in red noting it cannot be found, so I run the query:
select * from INFORMATION_SCHEMA.ROUTINES where ROUTINE_NAME = 'name_of_stored_procedure'
Nada. It returns nothing.
However if I go ahead and execute the stored procedure, it works fine.
What am I doing wrong?
For SSMS you just need to clear the Intellisense cache (Ctrl + Shift + R). Then the red squiggly line will disappear and Intellisense will help you out with that.
If you can view your Stored Proc under Programmability -> Stored Procedures in your object explorer, then you will be able to view it through your
select * from information_schema.routines ...query. Check your database context, as well as the rest of the query. Take out thewhereclause and look through the whole result set.