Skip to content

Commit 2eb49c4

Browse files
Merge pull request #36083 from MicrosoftDocs/main
Auto Publish – main to live - 2025-12-15 23:30 UTC
2 parents 6a7478f + bbdc5ab commit 2eb49c4

7 files changed

Lines changed: 132 additions & 132 deletions

.openpublishing.redirection.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50822,7 +50822,12 @@
5082250822
},
5082350823
{
5082450824
"source_path": "docs/advanced-analytics/install/sql-machine-learning-azure-data-studio.md",
50825-
"redirect_url": "/sql/machine-learning/install/sql-machine-learning-azure-data-studio",
50825+
"redirect_url": "/sql/machine-learning/install/sql-machine-learning-visual-studio-code",
50826+
"redirect_document_id": false
50827+
},
50828+
{
50829+
"source_path": "docs/machine-learning/install/sql-machine-learning-azure-data-studio.md",
50830+
"redirect_url": "/sql/machine-learning/install/sql-machine-learning-visual-studio-code",
5082650831
"redirect_document_id": true
5082750832
},
5082850833
{

docs/database-engine/service-broker/broker-system-messages.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ In addition to the application-defined message types specified in the contract,
2424

2525
## Error messages
2626

27-
When a remote service ends a dialog with an error or the local broker detects an unrecoverable error in a dialog, the local broker creates an Error Message. Error messages are of message type `https://schemas.microsoft.com/SQL/ServiceBroker/Error`. Error messages are validated as well-formed XML.
27+
When a remote service ends a dialog with an error or the local broker detects an unrecoverable error in a dialog, the local broker creates an Error Message. Error messages are of message type `http://schemas.microsoft.com/SQL/ServiceBroker/Error`. Error messages are validated as well-formed XML.
2828

29-
The XML document that is contained in an error message uses the namespace `https://schemas.microsoft.com/SQL/ServiceBroker`. The root element of the document has the local name **Error**, and contains an element named **Code** and an element named **Message**. The **Code** element holds an integer value. The **Message** element holds the human-readable text of the message.
29+
The XML document that is contained in an error message uses the namespace `http://schemas.microsoft.com/SQL/ServiceBroker`. The root element of the document has the local name **Error**, and contains an element named **Code** and an element named **Message**. The **Code** element holds an integer value. The **Message** element holds the human-readable text of the message.
3030

3131
For example, an error message generated by a service that processes expense reports might contain the following XML (reformatted for readability):
3232

docs/machine-learning/install/sql-machine-learning-azure-data-studio.md

Lines changed: 0 additions & 124 deletions
This file was deleted.
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
---
2+
title: "Visual Studio Code Notebooks (Python, R)"
3+
description: Learn how to run Python and R scripts in a notebook in Visual Studio Code with SQL Server Machine Learning Services.
4+
author: VanMSFT
5+
ms.author: vanto
6+
ms.date: 12/12/2025
7+
ms.service: sql
8+
ms.subservice: machine-learning-services
9+
ms.topic: how-to
10+
ms.custom:
11+
- sfi-image-nochange
12+
monikerRange: ">=sql-server-2017 || >=sql-server-linux-ver15"
13+
---
14+
# Run Python and R scripts in Visual Studio Code notebooks with SQL Server Machine Learning Services
15+
16+
[!INCLUDE [SQL Server 2017 and later](../../includes/applies-to-version/sqlserver2017.md)]
17+
18+
Learn how to run Python and R scripts in [Visual Studio Code](https://code.visualstudio.com) notebooks with [SQL Server Machine Learning Services](../sql-server-machine-learning-services.md). Visual Studio Code is a cross-platform development tool.
19+
20+
## Prerequisites
21+
22+
- Download and install [Visual Studio Code](https://code.visualstudio.com)) on your workstation. Visual Studio Code is cross-platform and runs on Windows, macOS, and Linux.
23+
24+
- Install the [Polyglot Notebooks extension](https://code.visualstudio.com/docs/languages/polyglot) for Visual Studio Code.
25+
26+
- A server with SQL Server Machine Learning Services installed and enabled. You can use Machine Learning Services on [Windows](sql-machine-learning-services-windows-install.md), [Linux](../../linux/sql-server-linux-setup-machine-learning.md), or [Big Data Clusters](../../big-data-cluster/machine-learning-services.md).
27+
28+
## Create a SQL notebook
29+
30+
> [!IMPORTANT]
31+
> Machine Learning Services runs as part of SQL Server. Therefore, you need to use a SQL kernel and not a Python kernel.
32+
33+
You can use Machine Learning Services in Visual Studio Code with a SQL notebook. To create a new notebook, follow these steps:
34+
35+
1. Select **File** and **New Notebook** to create a new notebook. The notebook uses the **SQL kernel** by default.
36+
37+
1. Select **Attach To** and **Change Connection**.
38+
39+
:::image type="content" source="media/ads-attach-to-connection.png" alt-text="Screenshot of Visual Studio Code SQL Notebook change connection.":::
40+
41+
1. Connect to an existing or new SQL Server. You can either:
42+
43+
1. Choose an existing connection under **Recent Connections** or **Saved Connections**.
44+
45+
1. Create a new connection under **Connection Details**. Fill out the connection details to your SQL Server and database.
46+
47+
:::image type="content" source="media/ads-connection-details.png" alt-text="Screenshot of Visual Studio Code SQL Notebook connection details.":::
48+
49+
## Run Python or R scripts
50+
51+
SQL Notebooks consist of code and text cells. Use code cells to run Python or R scripts through the stored procedure [sp_execute_external_scripts](../../relational-databases/system-stored-procedures/sp-execute-external-script-transact-sql.md). Use text cells to document your code in the notebook.
52+
53+
### Run a Python script
54+
55+
Follow these steps to run a Python script:
56+
57+
1. Select **+ Code** to add a code cell.
58+
59+
:::image type="content" source="media/ads-add-code.png" alt-text="Screenshot of Visual Studio Code SQL Notebooks add code block." lightbox="media/ads-add-code.png":::
60+
61+
1. Enter the following script in the code cell:
62+
63+
```sql
64+
EXECUTE sp_execute_external_script
65+
@language = N'Python',
66+
@script = N'
67+
a = 1
68+
b = 2
69+
c = a/b
70+
d = a*b
71+
print(c, d)
72+
';
73+
```
74+
75+
1. Select **Run cell** (the round black arrow) or press **F5** to run the single cell.
76+
77+
:::image type="content" source="media/ads-run-python.png" alt-text="Screenshot of Visual Studio Code SQL Notebooks run Python code." lightbox="media/ads-run-python.png":::
78+
79+
1. The result appears under the code cell.
80+
81+
:::image type="content" source="media/ads-run-python-output.png" alt-text="Screenshot of Visual Studio Code SQL Notebook Python code output." lightbox="media/ads-run-python-output.png":::
82+
83+
### Run an R script
84+
85+
Follow these steps to run an R script:
86+
87+
1. Select **+ Code** to add a code cell.
88+
89+
:::image type="content" source="media/ads-add-code.png" alt-text="Screenshot of Visual Studio Code SQL Notebooks add code block." lightbox="media/ads-add-code.png":::
90+
91+
1. Enter the following script in the code cell:
92+
93+
```sql
94+
EXECUTE sp_execute_external_script
95+
@language = N'R',
96+
@script = N'
97+
a <- 1
98+
b <- 2
99+
c <- a/b
100+
d <- a*b
101+
print(c(c, d))
102+
';
103+
```
104+
105+
1. Select **Run cell** (the round black arrow) or press **F5** to run the single cell.
106+
107+
:::image type="content" source="media/ads-run-r.png" alt-text="Screenshot of Visual Studio Code SQL Notebooks run R code." lightbox="media/ads-run-r.png":::
108+
109+
1. The result appears under the code cell.
110+
111+
:::image type="content" source="media/ads-run-r-output.png" alt-text="Screenshot of Visual Studio Code SQL Notebook R code output." lightbox="media/ads-run-r-output.png":::
112+
113+
## Related content
114+
115+
- [SQL Notebooks in Visual Studio Code](https://devblogs.microsoft.com/dotnet/net-interactive-with-sql-net-notebooks-in-visual-studio-code/)
116+
- [Jupyter Notebooks in VS Code](https://code.visualstudio.com/docs/datascience/jupyter-notebooks)
117+
- [Polyglot Notebooks in VS Code](https://code.visualstudio.com/docs/languages/polyglot)
118+
- [Quickstart: Run simple Python scripts with SQL machine learning](../tutorials/quickstart-python-create-script.md)
119+
- [Quickstart: Run simple R scripts with SQL machine learning](../tutorials/quickstart-r-create-script.md)

docs/machine-learning/sql-server-machine-learning-services.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Machine Learning Services uses an extensibility framework to run Python and R sc
4949
::: moniker range=">=sql-server-ver15||>=sql-server-linux-ver15||=azuresqldb-mi-current"
5050
1. [Install SQL Server Machine Learning Services on Windows](install/sql-machine-learning-services-windows-install.md) or [on Linux](../linux/sql-server-linux-setup-machine-learning.md?toc=/sql/machine-learning/toc.json). You can also use [Machine Learning Services on Big Data Clusters](../big-data-cluster/machine-learning-services.md) and [Machine Learning Services in Azure SQL Managed Instance](/azure/azure-sql/managed-instance/machine-learning-services-overview).
5151

52-
1. Configure your development tools. You can use [Run Python and R scripts in Azure Data Studio notebooks](install/sql-machine-learning-azure-data-studio.md). You can also run T-SQL in [Azure Data Studio](/azure-data-studio/what-is-azure-data-studio).
52+
1. Configure your development tools. You can use [Run Python and R scripts in Visual Studio Code notebooks](install/sql-machine-learning-visual-studio-code.md). You can also run T-SQL with the [MSSQL extension for Visual Studio Code](../tools/visual-studio-code-extensions/mssql/mssql-extension-visual-studio-code.md).
5353

5454
1. Write your first Python or R script.
5555

@@ -60,7 +60,7 @@ Machine Learning Services uses an extensibility framework to run Python and R sc
6060
::: moniker range="=sql-server-2017"
6161
1. [Install SQL Server Machine Learning Services on Windows](install/sql-machine-learning-services-windows-install.md).
6262

63-
1. Configure your development tools. You can use [Run Python and R scripts in Azure Data Studio notebooks](install/sql-machine-learning-azure-data-studio.md). You can also use T-SQL in [Azure Data Studio](/azure-data-studio/what-is-azure-data-studio).
63+
1. Configure your development tools. You can use [Run Python and R scripts in Visual Studio Code notebooks](install/sql-machine-learning-visual-studio-code.md). You can also use T-SQL with the [MSSQL extension for Visual Studio Code](../tools/visual-studio-code-extensions/mssql/mssql-extension-visual-studio-code.md).
6464

6565
1. Write your first Python or R script.
6666

docs/machine-learning/toc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ items:
5858
href: ../machine-learning/install/change-default-language-runtime-version.md
5959
- name: Upgrade Python and R runtime with binding
6060
href: ../machine-learning/install/upgrade-r-and-python.md
61-
- name: Azure Data Studio notebooks
62-
href: ../machine-learning/install/sql-machine-learning-azure-data-studio.md
61+
- name: Visual Studio Code notebooks
62+
href: ../machine-learning/install/sql-machine-learning-visual-studio-code.md
6363
- name: Set up a Python client
6464
href: ../machine-learning/python/setup-python-client-tools-sql.md
6565
- name: Set up an R client

docs/t-sql/statements/alter-database-scoped-configuration-transact-sql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ This setting is only available in [!INCLUDE [ssazuresynapse-md](../../includes/s
6767

6868
## Syntax
6969

70-
Syntax for SQL Server, Azure SQL Database, and Azure SQL Managed Instance:
70+
Syntax for SQL Server, Azure SQL Database, SQL database in Fabric, and Azure SQL Managed Instance:
7171

7272
```syntaxsql
7373
ALTER DATABASE SCOPED CONFIGURATION

0 commit comments

Comments
 (0)