Could not find stored procedure, however can execute it
In my case I solved the problem this way SIMPLY:
- Whenever I created the procedure I just execute the procedure on MSSQL Server Studio once. So I got the created procedure with the schema in the
db_name=>Programmibility=>Stored Procedure
. - Finally I called it from my C# code. And got solved!!!
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 the where
clause and look through the whole result set.
I had the same issue and I fixed it by simply using square brackets
EXEC [dbo].[procedureName]
Hope it helps someone later :)
Is it possible that your procedure is in a schema other than dbo
? You should always specify schema when creating and referencing objects. There are several reasons as described here. Essentially, when you don't specify the schema, you can have all sorts of confusing behavior depending on the default schema of the user who is creating or calling the procedure.
When checking for existence of objects you should also take schema into account.
Also you should check for procedures in sys.procedures
. Some background info on coding consistently here, since you can't always get the information you're after from INFORMATION_SCHEMA
.