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/relational-databases/system-stored-procedures/sp-set-session-context-transact-sql.md
+13-5Lines changed: 13 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: sp_set_session_context sets a key-value pair in the session context
4
4
author: VanMSFT
5
5
ms.author: vanto
6
6
ms.reviewer: randolphwest
7
-
ms.date: 03/07/2025
7
+
ms.date: 06/23/2025
8
8
ms.service: sql
9
9
ms.subservice: system-objects
10
10
ms.topic: "reference"
@@ -69,7 +69,9 @@ The total size of the session context is limited to 1 MB. If you set a value tha
69
69
You can monitor overall memory usage by querying [sys.dm_os_memory_cache_counters](../system-dynamic-management-views/sys-dm-os-memory-cache-counters-transact-sql.md) as follows:
70
70
71
71
```sql
72
-
SELECT*FROMsys.dm_os_memory_cache_countersWHERE type ='CACHESTORE_SESSION_CONTEXT';
72
+
SELECT*
73
+
FROMsys.dm_os_memory_cache_counters
74
+
WHERE type ='CACHESTORE_SESSION_CONTEXT';
73
75
```
74
76
75
77
## Examples
@@ -79,14 +81,20 @@ SELECT * FROM sys.dm_os_memory_cache_counters WHERE type = 'CACHESTORE_SESSION_C
79
81
The following example shows how to set and then return a session's context key named `language`, with a value of `English`.
Copy file name to clipboardExpand all lines: docs/relational-databases/system-stored-procedures/sp-setapprole-transact-sql.md
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: sp_setapprole activates the permissions associated with an applicat
4
4
author: VanMSFT
5
5
ms.author: vanto
6
6
ms.reviewer: randolphwest
7
-
ms.date: 08/22/2024
7
+
ms.date: 06/23/2025
8
8
ms.service: sql
9
9
ms.subservice: system-objects
10
10
ms.topic: "reference"
@@ -95,22 +95,23 @@ Requires membership in **public** and knowledge of the password for the role.
95
95
96
96
### A. Activate an application role without the encrypt option
97
97
98
-
The following example activates an application role named `SalesAppRole`, with the plain-text password `AsDeF00MbXX`, created with permissions designed for the application used by the current user.
98
+
The following example activates an application role named `SalesAppRole`, created with permissions designed for the application used by the current user. Replace `<password>` with a strong password.
### B. Activate an application role with a cookie and then reverting to the original context
106
106
107
-
The following example activates the `Sales11` application role with password `fdsd896#gfdbfdkjgh700mM`, and creates a cookie. The example returns the name of the current user, and then reverts to the original context by executing `sp_unsetapprole`.
107
+
The following example activates the `Sales11` application role, and creates a cookie. The example returns the name of the current user, and then reverts to the original context by executing `sp_unsetapprole`. Replace `<password>` with a strong password.
Copy file name to clipboardExpand all lines: docs/relational-databases/system-stored-procedures/sp-spaceused-transact-sql.md
+20-15Lines changed: 20 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: "sp_spaceused displays the number of rows, disk space reserved, and
4
4
author: markingmyname
5
5
ms.author: maghan
6
6
ms.reviewer: randolphwest
7
-
ms.date: 04/08/2024
7
+
ms.date: 06/23/2025
8
8
ms.service: sql
9
9
ms.subservice: system-objects
10
10
ms.topic: "reference"
@@ -140,8 +140,8 @@ This mode is the default, when no parameters are specified. The following result
140
140
| Column name | Data type | Description |
141
141
| --- | --- | --- |
142
142
|`database_name`|**nvarchar(128)**| Name of the current database. |
143
-
|`database_size`|**varchar(18)**| Size of the current database in megabytes. `database_size` includes both data and log files. If the database has a `MEMORY_OPTIMIZED_DATA` filegroup, this value includes the total on-disk size of all checkpoint files in the filegroup. |
144
-
|`unallocated space`|**varchar(18)**| Space in the database that isn't reserved for database objects. If the database has a `MEMORY_OPTIMIZED_DATA` filegroup, this value includes the total on-disk size of the checkpoint files with state `PRECREATED` in the filegroup. |
143
+
|`database_size`|**varchar(18)**| Size of the current database in megabytes. `database_size` includes both data and log files. If the database has a `MEMORY_OPTIMIZED_DATA` filegroup, this value includes the total on-disk size of all checkpoint files in the filegroup. |
144
+
|`unallocated space`|**varchar(18)**| Space in the database that isn't reserved for database objects. If the database has a `MEMORY_OPTIMIZED_DATA` filegroup, this value includes the total on-disk size of the checkpoint files with state `PRECREATED` in the filegroup. |
145
145
146
146
Space used by tables in the database. This result set doesn't reflect memory-optimized tables, as there's no per-table accounting of disk usage:
147
147
@@ -165,15 +165,15 @@ If *@objname* is omitted, the value of *@oneresultset* is `1`, and *@include_tot
165
165
| Column name | Data type | Description |
166
166
| --- | --- | --- |
167
167
|`database_name`|**nvarchar(128)**| Name of the current database. |
168
-
|`database_size`|**varchar(18)**| Size of the current database in megabytes. `database_size` includes both data and log files. If the database has a `MEMORY_OPTIMIZED_DATA` filegroup, this value includes the total on-disk size of all checkpoint files in the filegroup. |
169
-
|`unallocated space`|**varchar(18)**| Space in the database that isn't reserved for database objects. If the database has a `MEMORY_OPTIMIZED_DATA` filegroup, this value includes the total on-disk size of the checkpoint files with state `PRECREATED` in the filegroup. |
168
+
|`database_size`|**varchar(18)**| Size of the current database in megabytes. `database_size` includes both data and log files. If the database has a `MEMORY_OPTIMIZED_DATA` filegroup, this value includes the total on-disk size of all checkpoint files in the filegroup. |
169
+
|`unallocated space`|**varchar(18)**| Space in the database that isn't reserved for database objects. If the database has a `MEMORY_OPTIMIZED_DATA` filegroup, this value includes the total on-disk size of the checkpoint files with state `PRECREATED` in the filegroup. |
170
170
|`reserved`|**varchar(18)**| Total amount of space allocated by objects in the database. |
171
171
|`data`|**varchar(18)**| Total amount of space used by data. |
172
172
|`index_size`|**varchar(18)**| Total amount of space used by indexes. |
173
173
|`unused`|**varchar(18)**| Total amount of space reserved for objects in the database, but not yet used. |
174
174
|`xtp_precreated` <sup>1</sup> |**varchar(18)**| Total size of checkpoint files with state `PRECREATED`, in KB. This value counts toward the unallocated space in the database as a whole. Returns `NULL` if the database doesn't have a `MEMORY_OPTIMIZED_DATA` filegroup with at least one container. |
175
-
|`xtp_used` <sup>1</sup> |**varchar(18)**| Total size of checkpoint files with states `UNDER CONSTRUCTION`, `ACTIVE`, and `MERGE TARGET`, in KB. This value is the disk space actively used for data in memory-optimized tables. Returns `NULL` if the database doesn't have a `MEMORY_OPTIMIZED_DATA` filegroup with at least one container. |
176
-
|`xtp_pending_truncation` <sup>1</sup> |**varchar(18)**| Total size of checkpoint files with state `WAITING_FOR_LOG_TRUNCATION`, in KB. This value is the disk space used for checkpoint files that are awaiting cleanup, once log truncation happens. Returns `NULL` if the database doesn't have a `MEMORY_OPTIMIZED_DATA` filegroup with at least one container. |
175
+
|`xtp_used` <sup>1</sup> |**varchar(18)**| Total size of checkpoint files with states `UNDER CONSTRUCTION`, `ACTIVE`, and `MERGE TARGET`, in KB. This value is the disk space actively used for data in memory-optimized tables. Returns `NULL` if the database doesn't have a `MEMORY_OPTIMIZED_DATA` filegroup with at least one container. |
176
+
|`xtp_pending_truncation` <sup>1</sup> |**varchar(18)**| Total size of checkpoint files with state `WAITING_FOR_LOG_TRUNCATION`, in KB. This value is the disk space used for checkpoint files that are awaiting cleanup, once log truncation happens. Returns `NULL` if the database doesn't have a `MEMORY_OPTIMIZED_DATA` filegroup with at least one container. |
177
177
178
178
<sup>1</sup> Only included if *@include_total_xtp_storage* is set to `1`.
179
179
@@ -203,7 +203,8 @@ The following example reports disk space information for the `Vendor` table and
203
203
```sql
204
204
USE AdventureWorks2022;
205
205
GO
206
-
EXEC sp_spaceused N'Purchasing.Vendor';
206
+
207
+
EXECUTE sp_spaceused N'Purchasing.Vendor';
207
208
GO
208
209
```
209
210
@@ -214,7 +215,8 @@ The following example summarizes space used in the current database and uses the
214
215
```sql
215
216
USE AdventureWorks2022;
216
217
GO
217
-
EXEC sp_spaceused @updateusage = N'TRUE';
218
+
219
+
EXECUTE sp_spaceused @updateusage = N'TRUE';
218
220
GO
219
221
```
220
222
@@ -226,7 +228,7 @@ The following example summarizes the space used by the remote table associated w
### D. Display space usage information for a database in a single result set
@@ -236,18 +238,20 @@ The following example summarizes space usage for the current database in a singl
236
238
```sql
237
239
USE AdventureWorks2022;
238
240
GO
239
-
EXEC sp_spaceused @oneresultset =1;
241
+
242
+
EXECUTE sp_spaceused @oneresultset =1;
240
243
```
241
244
242
245
### E. Display space usage information for a database with at least one MEMORY_OPTIMIZED file group in a single result set
243
246
244
247
The following example summarizes space usage for the current database with at least one `MEMORY_OPTIMIZED` file group in a single result set.
245
248
246
249
```sql
247
-
USE WideWorldImporters
250
+
USE WideWorldImporters;
248
251
GO
249
252
250
-
EXEC sp_spaceused @updateusage ='FALSE',
253
+
EXECUTE sp_spaceused
254
+
@updateusage ='FALSE',
251
255
@mode ='ALL',
252
256
@oneresultset ='1',
253
257
@include_total_xtp_storage ='1';
@@ -259,10 +263,11 @@ GO
259
263
The following example summarizes space usage for a `MEMORY_OPTIMIZED` table object in the current database with at least one `MEMORY_OPTIMIZED` file group.
0 commit comments