Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 problem in execute the stored procedure

Author  Topic 

pooya1072
Starting Member

13 Posts

Posted - 2013-03-16 : 13:08:22
hi
i craete a SP in my database . by this command :
USE [MyDatabase];
GO
CREATE PROCEDURE test
AS
SET NOCOUNT ON;
SELECT id, feed1, feed2
FROM NFFeeds

i can see this sp under StoredProcedure in my database .
so...i write this command in Query :
use [MyDatabase]
exec dbo.test

at this time a red underline appear under 'test' . if i set mouse cursor on it this error shows as a tag :
"Could not find stored procedure 'test' "
but if i execute the sp , it's execue normal and i can show the result . what this mean?

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2013-03-16 : 14:20:35
your default schema is not dbo.

whatever it is should replace dbo in your query. OR when creating it, explicitly create in under dbo schema.

CREATE PROC dbo.Test...

If you aren't sure what schema you created it under, this will show you

select schema_name(schema_id) from sys.procedures where name = 'test'
Go to Top of Page

pooya1072
Starting Member

13 Posts

Posted - 2013-03-16 : 16:43:56
i checked it.the default schema was dbo.
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-03-16 : 21:30:22
Run the first line by itself and see if you still get the error squiggly. What I am suspecting is that the current database is something else and it does not see a stored procedure by that name in that database. However, that is only a guess - I am not seeing that behavior in my SSMS (SQL 2008 R2). What version of SSMS and database are you using?
Go to Top of Page

pooya1072
Starting Member

13 Posts

Posted - 2013-03-17 : 05:06:05
thanks... but with the help of frinds i find the solution :
Edit Menu/Intellisense/Refresh Local Cache ....... it's done
Go to Top of Page
   

- Advertisement -