@@ -56,7 +56,7 @@ This tutorial requires the *TutorialDB* database. To create the *TutorialDB* dat
5656
5757 ![ edit data] ( ./media/tutorial-sql-editor/edit-data.png )
5858
59- ## Use T-SQL snippets and IntelliSense to create a stored procedure
59+ ## Use T-SQL snippets to create a stored procedure
6060
6161### Use snippets in [ !INCLUDE[ name-sos-short] ( ../includes/name-sos-short.md )]
6262
@@ -70,19 +70,40 @@ This tutorial requires the *TutorialDB* database. To create the *TutorialDB* dat
7070
7171 ![ snippet] ( ./media/tutorial-sql-editor/snippet.png )
7272
73- 4 . Press * Tab* and then type * dbo* to replace the * SchemaName* entries.
74-
75- 5 . Replace ``` @param1... ``` with:
76-
77- ``` sql
78- @ID int
79- ```
80-
81- ![ snippet-scripting] ( ./media/tutorial-sql-editor/snippet-scripting.png )
82-
83- 6 . Delete the example arguments in the EXECUTE statement. The final statement should be: ``` EXECUTE dbo.getCustomer 1 ``` .
84-
85- 7 . To create the stored procedure and give it a test run, press ** F5** .
73+ 4 . Replace the rest of the stored procedure with the T-SQL below
74+
75+ ```sql
76+ -- Create a new stored procedure called 'getCustomer' in schema 'dbo'
77+ -- Drop the stored procedure if it already exists
78+ IF EXISTS (
79+ SELECT *
80+ FROM INFORMATION_SCHEMA.ROUTINES
81+ WHERE SPECIFIC_SCHEMA = N'dbo'
82+ AND SPECIFIC_NAME = N'getCustomer'
83+ )
84+ DROP PROCEDURE dbo.getCustomer
85+ GO
86+ -- Create the stored procedure in the specified schema
87+ CREATE PROCEDURE dbo.getCustomer
88+ @ID int
89+ -- add more stored procedure parameters here
90+ AS
91+ -- body of the stored procedure
92+ SELECT c.CustomerID,
93+ c.Name,
94+ c.Location,
95+ c.Email
96+ FROM dbo.Customers c
97+ WHERE c.CustomerID = @ID
98+ FOR JSON PATH
99+
100+ GO
101+ -- example to execute the stored procedure we just created
102+ EXECUTE dbo.getCustomer 1
103+ GO
104+ ```
105+
106+ 5 . To create the stored procedure and give it a test run, press ** F5** .
86107
87108## Use Peek Definition and Go to Definition
88109
@@ -105,7 +126,7 @@ This tutorial requires the *TutorialDB* database. To create the *TutorialDB* dat
105126
106127 ![ peek definition] ( ./media/tutorial-sql-editor/peek-definition.png )
107128
108- 6 . By referencing the table defintion in the peek definition, complete the following insert statement.??WHAT EXACTLY AM I DOING HERE - JUST LOOKING OR DOES THIS HELP ME CREATE THE STATEMENT??
129+ 6 . Use the table defintion in the peek definition, complete the following insert statement
109130
110131 ``` sql
111132 INSERT INTO dbo .Customers (CustomerID, Name, Location, Email)
0 commit comments