Skip to content

Commit 9d5acf1

Browse files
authored
Merge pull request #22284 from MicrosoftDocs/WilliamDAssafMSFT-patch-2
20220601 Update image code, fix alt text bug
2 parents 6c3c2cf + 0595f8e commit 9d5acf1

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

docs/relational-databases/security/encryption/always-encrypted-query-columns-ssms.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
title: "Query columns using Always Encrypted with SQL Server Management Studio | Microsoft Docs"
33
description: Learn how to query columns in Always Encrypted using SQL Server Management Studio. Retrieve ciphertext or text values stored in encrypted columns.
44
ms.custom: ""
5-
ms.date: 01/15/2021
5+
ms.date: 06/1/2022
66
ms.prod: sql
77
ms.reviewer: vanto
88
ms.technology: security
99
ms.topic: conceptual
1010
helpviewer_keywords:
1111
- "Always Encrypted, configure with SSMS"
12-
ms.assetid: 29816a41-f105-4414-8be1-070675d62e84
1312
author: jaszymas
1413
ms.author: jaszymas
1514
monikerRange: "=azuresqldb-current||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current"
@@ -35,7 +34,7 @@ Running SELECT queries that retrieve ciphertext of data stored in encrypted colu
3534
### Example
3635
Assuming `SSN` is an encrypted column in the `Patients` table, the query shown below will retrieve binary ciphertext values, if Always Encrypted is disabled for the database connection.
3736

38-
![Screenshot of the SELECT [SSN] FROM [dbo].[Patients] query and the results of the query shown as binary ciphertext values.](../../../relational-databases/security/encryption/media/always-encrypted-ciphertext.png)
37+
:::image type="content" source="../../../relational-databases/security/encryption/media/always-encrypted-ciphertext.png" alt-text="Screenshot of the SELECT [SSN] FROM [dbo].[Patients] query and the results of the query shown as binary ciphertext values." lightbox="../../../relational-databases/security/encryption/media/always-encrypted-ciphertext.png":::
3938

4039
## Retrieving plaintext values stored in encrypted columns
4140
To retrieve values from an encrypted column as plaintext (to decrypt the values):
@@ -46,7 +45,7 @@ To retrieve values from an encrypted column as plaintext (to decrypt the values)
4645
### Example
4746
Assuming SSN is an encrypted `char(11)` column in the `Patients` table, the query, shown below, will return plaintext values, if Always Encrypted is enabled for the database connection and if you have access to the column master key configured for the `SSN` column.
4847

49-
![Screenshot of the SELECT [SSN] FROM [Clinic].[dbo].[Patients] query and the results of the query shown as plain text values.](../../../relational-databases/security/encryption/media/always-encrypted-plaintext.png)
48+
:::image type="content" source="../../../relational-databases/security/encryption/media/always-encrypted-plaintext.png" alt-text="Screenshot of the SELECT [SSN] FROM [Clinic].[dbo].[Patients] query and the results of the query shown as plain text values." lightbox="../../../relational-databases/security/encryption/media/always-encrypted-plaintext.png":::
5049

5150
## Sending plaintext values targeting encrypted columns
5251
To execute a query that sends a value that targets an encrypted column, for example a query that inserts, updates or filters by a value stored in an encrypted column:
@@ -60,7 +59,7 @@ To execute a query that sends a value that targets an encrypted column, for exam
6059
### Example
6160
Assuming `SSN` is an encrypted `char(11)` column in the `Patients` table, the below script will attempt to find a row containing `'795-73-9838'` in the SSN column and return the value of the `LastName` column, providing Always Encrypted is enabled for the database connection, Parameterization for Always Encrypted is enabled for the Query Editor window, and you have access to the column master key configured for the `SSN` column.
6261

63-
![Screenshot of the DECLARE @SSN CHAR(11) = '795-73-9838' SELECT [LastName] FROM [dbo].[Patients] WHERE [SSN] = @SSN query and the results of the query.](../../../relational-databases/security/encryption/media/always-encrypted-patients.png)
62+
:::image type="content" source="../../../relational-databases/security/encryption/media/always-encrypted-patients.png" alt-text="Screenshot of the query using a variable for @SSN and the resulting row returned." lightbox="../../../relational-databases/security/encryption/media/always-encrypted-patients.png":::
6463

6564
## Permissions for querying encrypted columns
6665

@@ -180,11 +179,11 @@ If SQL Server Management Studio has attempted to parameterize a variable, but th
180179

181180
The below screenshot shows an example of six variable declarations. SQL Server Management Studio successfully parameterized the first three variables. The last three variables didn't meet the pre-requisite conditions for parameterization, and therefore, SQL Server Management Studio didn't attempt to parameterize them (their declarations aren't marked in any way).
182181

183-
![Screenshot showing an example of six variable declarations with three successfully parameterized and three failures and the associated warning messages.](../../../relational-databases/security/encryption/media/always-encrypted-parameter-warnings.png)
184-
182+
:::image type="content" source="../../../relational-databases/security/encryption/media/always-encrypted-parameter-warnings.png" alt-text="Screenshot showing an example of six variable declarations with three successfully parameterized and three failures and the associated warning messages." lightbox="../../../relational-databases/security/encryption/media/always-encrypted-parameter-warnings.png":::
183+
185184
Another example below, shows two variables that meet pre-requisite conditions for parameterization, but the parameterization attempt has failed because the variables are incorrectly initialized.
186185

187-
![Screenshot showing an example of two variable declarations that ultimately fail with the associated error messagess.](../../../relational-databases/security/encryption/media/always-encrypted-error.png)
186+
:::image type="content" source="../../../relational-databases/security/encryption/media/always-encrypted-error.png" alt-text="Screenshot showing an example of two variable declarations that ultimately fail with the associated error messages." lightbox="../../../relational-databases/security/encryption/media/always-encrypted-error.png":::
188187

189188
> [!NOTE]
190189
> As Always Encrypted supports a limited subset of type conversions, in many cases it is required that the data type of a Transact-SQL variable is the same as the type of the target database column, it targets. For example, assuming type of the `SSN` column in the `Patients` table is `char(11)`, the below query will fail, as the type of the `@SSN` variable, which is `nchar(11)`, does not match the type of the column.
@@ -213,4 +212,4 @@ column_encryption_key_database_name = 'Clinic') are incompatible in the equal to
213212

214213

215214
## See Also
216-
- [Always Encrypted](../../../relational-databases/security/encryption/always-encrypted-database-engine.md)
215+
- [Always Encrypted](../../../relational-databases/security/encryption/always-encrypted-database-engine.md)

0 commit comments

Comments
 (0)