On SQL Server 2008, how can I place my stored procedures in "Stored Procedures" folder of my DB?
When I declare it this way:
CREATE PROCEDURE mySchema.myProc
It goes to:
MYSERVER\System Databases\Master\Programmability\Stored procedures folder.
How to tell server, to store it in:
MYSERVER\System Databases\MYDB\Programmability\Stored procedures folder.
EDIT:
If I declare it like that:
CREATE PROCEDURE [myDB].mySchema.myProc
It complains about:
'CREATE/ALTER PROCEDURE' does not allow specifying the database name as a prefix to the object name.
If I use the 'USE' keyword, It complains:
a USE database statement is not allowed in a procedure, function or trigger.
Maybe the problem is that I'm using MS Management Studio, and connecting directly to the server, and not to any particular DB?
You can not use Stored Procedure in where clause but can use User Defined Function in where clause. If you cant convert SP to function then you have to first get bit value from executing SP and use that variable in where clause..
You can find the stored procedure in the Object Explorer, under Programmability > Stored Procedures as shown in the following picture: Sometimes, you need to click the Refresh button to manually update the database objects in the Object Explorer.
Using SQL Server Management Studio Expand Databases, expand the database in which the procedure belongs, and then expand Programmability. Expand Stored Procedures, right-click the procedure and then click View Dependencies. View the list of objects that depend on the procedure.
Within SQL Server Studio, stored procedures, or procedures for short, reside within any database, under the programmability subdirectory.
Try the following
USE MyDb
GO
CREATE PROCEDURE mySchema.myProc
It looks like you are creating the procedure in master database instead of your database.
Add Use MYDB
above the create script of the stored procedure and it will be created in your database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With