- SQL Server Management Studio
- Some data to use for the test.
- Some knowledge of SQL Queries
- Open SQL Server 2008. SQL Server 2008 R2, 2005 or 2014 would also work. This presentation is made using SQL Server 2008 R@
- Import the data you want to use into SQL Server ( Tasks – Import)
- Expand the database node
- Expand the Programability node
- Right-click on the Stored Procedures node and click on New Stored Procedure
- Erase Everything that appears so that you will have a bland space.
- Enter the code below:
- Click on the execute button on the toolbar to execute the stored procedure. (this assumes that you have a table named tblMembers)
- Expand the Stored Procedure node
- Right-click on the Stored Procedure you want to alter
- Click on Modify( the Second item in the context menu). This opens the stored-procedure window
- Go ahead to make the needed modification an click on execute to save the changes.
- Knowledge of Writing SQL Queries(How To Write SQL Queries)
How to Write Store Procedures in SQL Server
In this video, Kindson The Tech Pro explains how to write stored procedures in SQL Server in few minutes.
Personally I could not believe it when I learned how to write stored procedures in SQL Server. I was so easy to learn. Sometimes even news DBAs find it difficult to get a starting point in writing stored procedure.
Once thing you need to remember is that stored procedures are simply sql queries that have been saved for resuse.
Items you would require include
So carefully follow the instructions below:
CREATE Stored procedure GetMembers
AS
SELECT * FROM tblMembers
How to Modify and Existing Stored Procedure
To Create a Parameterized Stored Procedure, use the syntax below
CREATE Stored procedure GetMembers
@Firstname VARCHAR(50)
AS
SELECT * FROM tblMembers WHERE Firstname = @Firstname
Thank you for reading. If you have any issued, do leave a comment below.
Do leave a comment below if you need me to explain more.
Get more on: Kindson The Tech Pro
great.
ReplyDelete