2

So i'm following a tutorial on how to connect a database to WFA and at this step he saves the procedure, but don't know where because he skips.

My question: How do I save it inside the folder because whenever I want to save, it wants me to choose a path and doesn't save directly in the "Stored Procedures" folder.

enter image description here

jophab
  • 5,356
  • 14
  • 41
  • 60
Elsawhere
  • 65
  • 4
  • 2
    Just create it :) – Ilyes Dec 13 '17 at 11:04
  • You don't need to save the `SP` in the folder or even choose a path for that, all what you need is targeting the right database, create your `SP` and excute the code. – Ilyes Dec 13 '17 at 11:08
  • An obvious thing to most, but maybe handy for the person asking: What you are trying to save is a text file that holds code. If you place a 'create procedure'-line above (as shown below) and execute the code, the procedure is created (saved). – Steef Dec 13 '17 at 14:22

2 Answers2

3

To answer your question SQL SERVER automatically saves your stored procedures within the Programmability -> Stored Procedures -> Your SP upon creation.

Note : Always remember to refresh the Stored Procedures Folder after you have created a new Stored Procedure, otherwise you might not be able to see it (but its there, dont worry)

UPDATE

Here is a TSQL statement to create a Stored Procedure (of course you can change it to your own vision) :

USE YourDatabaseName
GO

CREATE PROCEDURE SchemaName.SPName
AS
SELECT * FROM SchemaName.TableName
GO

This will Create a Simple SP for your service (assuming you have excuted it). Now can look for it as above.

Remember You need to look for it within your SQL Server Management Studio. not within Visual Studio (Which you will be able to Call the SP later within your C# code using An ORM)

Masoud Andalibi
  • 3,168
  • 5
  • 18
  • 44
1

Suppose you are creating a procedure like below

CREATE PROC Test
AS 
SELECT * FROM table_name

If you write this in SQL Server Management Studio and Execute (F5) against a DB, this will come under Programmability -> Stored Procedures.

Just execute the code and refresh the DB in Object Explorer and check under

Programmability -> Stored Procedures

OR

If you are trying to create the procedure from C# code, Just execute it like normal sql query through the C# code against the DB.

This will also create a procedure under Programmability -> Stored Procedures. Check SSMS in the same way as above to see.

OR

If you are trying to execute a stored procedure through C# code refer this

jophab
  • 5,356
  • 14
  • 41
  • 60