In Server Explorer (within Visual Studio) I can expand a database, right click on the Stored Procedures folder, and select "Add New Stored Procedure"
I can then add an SP and try to execute it. However, when I try to save the Stored Procedure (so that it will be subsequently available in the list of Stored Procedures for that database), it gives it the generic name "dbo.Procedure.sql*", even though I gave it another name, such as:
CREATE PROCEDURE [dbo].[duckbilledPlatypiOfIowa]
When the save dialog displays (wanting to save the .sql file to my Documents folder), I can rename it what I want, but it is not available in the list of Stored Procedures in the database.
How can I get it to be available there?
Note: If I right-click the Stored Procedure pane and select "copy path" (or some such), I do get what seems valid, namely:
MSSQL::/PROSQL42/PlatypusData/sa/SqlProcedure/dbo.Procedure.sql
But again, you see the generic "dbo.Procedure.sql" name. Yet no "dbo.Procedure.sql" displays in the list of Stored Procedures after saving, either.
So again, what do I need to do to save my new Stored Procedure into the database I'm working with?
CREATE PROCEDURE [dbo].[duckbilledPlatypiOfIowa]
and the definition that follows is the TSQL which will 'save' it to the database.
If you run that line again, you should get an error saying that it already exists.
To verify that it does, right-click the 'Stored Procedures' node and choose 'Refresh'.
If it doesn't appear in the database you think you're working with, check the connection of the window you're in.
To be sure, add
USE [DatabaseName]
GO
Before executing your CREATE PROCEDURE [dbo].[duckbilledPlatypiOfIowa]