You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/carbon/get-started-sql-database.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,11 +20,11 @@ This quickstart demonstrates how to use [!INCLUDE[name-sos](../includes/name-sos
20
20
21
21
## Prerequisites
22
22
23
-
To complete this quickstart, you need !INCLUDE[name-sos](../includes/name-sos-short.md), and an Azure SQL server where you have *CREATE DATABASE* permissions.
23
+
To complete this quickstart, you need [!INCLUDE[name-sos](../includes/name-sos-short.md)], and an Azure SQL server where you have *CREATE DATABASE* permissions.
Copy file name to clipboardExpand all lines: docs/carbon/get-started-sql-server.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,14 +20,14 @@ This article shows how to get started using [!INCLUDE[name-sos](../includes/name
20
20
21
21
## Prerequisites
22
22
23
-
To complete this quickstart, you need [!INCLUDE[name-sos](../includes/name-sos-short.md)], and access to a SQL Server where you have *CREATE DATABASE* permissions.
23
+
To complete this quickstart, you need [!INCLUDE[name-sos](../includes/name-sos-short.md)], and access to a SQL Server.
Copy file name to clipboardExpand all lines: docs/carbon/tutorial-modern-code-flow-sql-server.md
+56-46Lines changed: 56 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
-
title: Run SQL queries using Microsoft SQL Operations Studio | Microsoft Docs
3
-
description: This tutorial...
2
+
title: Working with T-SQL using Microsoft SQL Operations Studio | Microsoft Docs
3
+
description: This tutorial walks through the key features in SQL Operations Studio that simplify using T-SQL.
4
4
keywords:
5
5
ms.custom: "tools|sos"
6
6
ms.date: "11/01/2017"
@@ -15,7 +15,7 @@ manager: craigg
15
15
ms.workload: "Inactive"
16
16
---
17
17
18
-
# Create and run queries using [!INCLUDE[name-sos](../includes/name-sos-short.md)]
18
+
# Working with T-SQL using [!INCLUDE[name-sos](../includes/name-sos-short.md)]
19
19
20
20
Creating and running queries, stored procedures, scripts, etc. are the core tasks of database professionals. This tutorial walks through the key features in [!INCLUDE[name-sos](../includes/name-sos-short.md)] that simplify using T-SQL.
21
21
@@ -29,51 +29,61 @@ In this tutorial, you learn how to use [!INCLUDE[name-sos-short](../includes/nam
29
29
30
30
## Prerequisites
31
31
32
-
To complete this tutorial, [install [!INCLUDE[name-sos](../includes/name-sos-short.md)]](download.md).
32
+
This tutorial requires the *TutorialDB* database. To create the *TutorialDB* database, complete one of the following quickstarts:
33
33
34
+
-[Connect and query SQL Server using [!INCLUDE[name-sos-short](../includes/name-sos-short.md)]](get-started-sql-server.md)
35
+
-[Connect and query Azure SQL Database using [!INCLUDE[name-sos-short](../includes/name-sos-short.md)]](get-started-sql-database.md)
36
+
-[Connect and query SQL Data Warehouse using [!INCLUDE[name-sos-short](../includes/name-sos-short.md)]](get-started-sql-dw.md)
34
37
35
-
## Quickly find a table and edit data
36
-
[!INCLUDE[name-sos-short](../includes/name-sos-short.md)] provides a quick database schema object search functionality using 'Explorer widget' in a dashboard and quickly launch a task based on an object type such as 'Edit data' for a table.
37
38
38
-
1. Open Servers viewlet with ```CTRL+G``` and expand ```Databases``` folder. Select ```TutorialDB```.
39
39
40
-
2. Open TutorialDB Dashboard using ```Manage``` context menu with right-mouse-click.
40
+
## Quickly locate a database object and perform a common task
[!INCLUDE[name-sos-short](../includes/name-sos-short.md)] provides a search widget to quickly find database objects. The results list provides a context menu for common tasks relevant to the selected object, such as *Edit Data* for a table.
43
43
44
-
3. Type ```Customer``` in Search widget as shown below.
44
+
1. Open the SERVERS sidebar (**CTRL+G**), expand **Databases**, and select **TutorialDB**.
45
45
46
-
4. Select ```dbo.Customer``` table from Search widget on the dashboard and run ```Edit data```context menu with right-mouse-click.
46
+
1. Open the *TutorialDB Dashboard* by selecting **Manage** from the context menu.
## Use T-SQL snippet and IntelliSense to create a stored procedure
59
+
## Use T-SQL snippets and IntelliSense to create a stored procedure
57
60
58
-
1. Press 'CTRL + N' to open a new editor.
61
+
### Use snippets in [!INCLUDE[name-sos-short](../includes/name-sos-short.md)]
59
62
60
-
2. Type ```sql``` in the editor, then select ```sqlCreateStoredProcedure```. Press ```Tab```. [!INCLUDE[name-sos-short](../includes/name-sos-short.md)] creates a new stored procedure snippet.
63
+
1. Open a new query editor by pressing **CTRL + N**.
64
+
65
+
2. Type **sql** in the editor, arrow down to **sqlCreateStoredProcedure**, and press the *Tab* key to load the new stored procedure snippet.
4. Press ```Tab``` and then type ```dbo``` for ```SchemaName``` entry.
73
+
4. Press *Tab* and then type *dbo* to replace the *SchemaName* entries.
68
74
69
-
5.Type in the following parameter definition.
75
+
5.Replace ```@param1...``` with:
70
76
71
77
```sql
72
-
CREATE PROCEDURE dbo.GetCustomer
73
78
@ID int
74
79
```
75
80
76
-
6. Using T-SQL Intellisense, type in the following SELECT statement in the body of procedure. Tip: Type in ```SELECT FROM dbo.Customers c``` first and type the rest as IntelliSense guides you.
81
+
### Use IntelliSense in [!INCLUDE[name-sos-short](../includes/name-sos-short.md)]
82
+
??THIS DOES NOT WORK AND NEEDS HELP!!??
83
+
1. Type in the following SELECT statement in the body of procedure.
84
+
85
+
> [!TIP]
86
+
> Type *SELECT FROM dbo.Customers c*, and complete the rest as IntelliSense guides you.
77
87
78
88
```sql
79
89
SELECTc.CustomersID,
@@ -87,31 +97,33 @@ To complete this tutorial, [install [!INCLUDE[name-sos](../includes/name-sos-sho
7. Delete the example arguments in the EXECUTE statement. The final statement should be: ```EXECUTE dbo.getCustomer 1```.
101
+
102
+
103
+
1. To create the stored procedure and give it a test run, press **F5**.
91
104
92
105
## Use Peek Definition and Go to Definition
93
106
94
-
1.Press 'CTRL + N' to open a new editor.
107
+
1.Open a new editor by pressing **CTRL + N**.
95
108
96
-
2. Type and select ```sqlCreateStoredProcedure``` from the snippet suggestion list. Type in ```SetCustomer``` for ```StoredProcedureName``` and ```dbo``` for ```SchemaName```.
97
-
3.Specify following parameter:
109
+
2. Type and select **sqlCreateStoredProcedure** from the snippet suggestion list. Type in **setCustomer** for **StoredProcedureName** and **dbo** for **SchemaName**
110
+
3.Replace the @param lines with the following parameter definition:
98
111
99
112
```sql
100
-
CREATE PROCEDURE dbo.SetCustomer
101
113
@json_val nvarchar(max)
102
114
```
103
115
104
-
4.In the body of procedure, type in following:
116
+
4.Replace the body of the stored procedure with the following:
105
117
```sql
106
118
-- body of the stored procedure
107
119
INSERT INTOdbo.Customers
108
120
```
109
121
110
-
5. Right-mouse-click on ```dbo.Customers``` and run ```Peek Definition```
122
+
5. Right-click **dbo.Customers** and select **Peek Definition**.
6. By referencing the table defintion in the peek definition, complete the following insert statement.
126
+
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??
@@ -125,18 +137,18 @@ To complete this tutorial, [install [!INCLUDE[name-sos](../includes/name-sos-sho
125
137
7. The final statement should be:
126
138
127
139
```sql
128
-
-- Create a new stored procedure called 'SetCustomer' in schema 'dbo'
140
+
-- Create a new stored procedure called 'setCustomer' in schema 'dbo'
129
141
-- Drop the stored procedure if it already exists
130
142
IF EXISTS (
131
143
SELECT*
132
144
FROMINFORMATION_SCHEMA.ROUTINES
133
145
WHERE SPECIFIC_SCHEMA = N'dbo'
134
-
AND SPECIFIC_NAME = N'SetCustomer'
146
+
AND SPECIFIC_NAME = N'setCustomer'
135
147
)
136
-
DROP PROCEDURE dbo.SetCustomer
148
+
DROP PROCEDURE dbo.setCustomer
137
149
GO
138
150
-- Create the stored procedure in the specified schema
139
-
CREATE PROCEDURE dbo.SetCustomer
151
+
CREATE PROCEDURE dbo.setCustomer
140
152
@json_val nvarchar(max)
141
153
AS
142
154
-- body of the stored procedure
@@ -151,25 +163,23 @@ To complete this tutorial, [install [!INCLUDE[name-sos](../includes/name-sos-sho
151
163
GO
152
164
```
153
165
154
-
8. Press ```F5``` and execute the script.
155
-
156
-
## Save as Json
166
+
8. Press **F5** and execute the script.
157
167
158
-
In this step, we will walkthrough how Save as JSON can make a developing and testing application login in stored procedures and using JSON as a data format in applications.
168
+
## Save query results as JSON
159
169
160
-
1. First, run ```SELECT TOP 1000 Rows``` from dbo.Customers table.
170
+
In this step, we walkthrough how the **Save as JSON** option makes developing and testing application login in stored procedures and using JSON as a data format in applications.
161
171
162
-
2. Select and highlight the first row in the result view.
172
+
1.**SELECT TOP 1000 Rows** from the *dbo.Customers* table.
163
173
164
-
3. Click ```Save as Json```. It opens the highlighted row in json format.
174
+
2. Select the first row in the results view and click **Save as JSON**. 1. Click **Save**, and it opens the highlighted row in JSON format.
165
175
166
-

176
+

167
177
168
-
4. Select the json data and copy with ```CTRL+C```.
178
+
4. Select the JSON data and copy it.
169
179
170
-
5. Open a new query for TutorialDB and paste the json data into the new query editor.
180
+
5. Open a new query for *TutorialDB* and paste the JSON data into the new query editor.
171
181
172
-
6. Complete the following test script using the json data as a template in the previous step. Modify the values for ```CustomerID```, ```Name```, ```Location``` and ```Email```.
182
+
6. Complete the following test script using the json data as a template in the previous step. Modify the values for *CustomerID*, *Name*, *Location*, and *Email*.
173
183
174
184
```sql
175
185
-- example to execute the stored procedure we just created
@@ -189,7 +199,7 @@ In this step, we will walkthrough how Save as JSON can make a developing and tes
189
199
EXECUTE dbo.getCustomer @ID =5
190
200
```
191
201
192
-
7.Press ```F5``` and execute the script. It inserts a new Customer and returns the new Customer's information in json format. Click the result.
202
+
7.Execute the script by pressing *F5**. The script inserts a new customer and returns the new customer's information in JSON format. Click the result to open a formatted view.
0 commit comments