SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 problem in execute the stored procedure
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pooya1072
Starting Member

13 Posts

Posted - 03/16/2013 :  13:08:22  Show Profile  Reply with Quote
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

USA
5072 Posts

Posted - 03/16/2013 :  14:20:35  Show Profile  Visit russell's Homepage  Reply with Quote
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 - 03/16/2013 :  16:43:56  Show Profile  Reply with Quote
i checked it.the default schema was dbo.
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3712 Posts

Posted - 03/16/2013 :  21:30:22  Show Profile  Reply with Quote
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 - 03/17/2013 :  05:06:05  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000