3> CREATE TABLE ForEncDemo (
4> rowid int IDENTITY(1,1) PRIMARY KEY,
5> name nvarChar(20),
6> id_data_orig Nvarchar(11),
7> id_data_enc varbinary(70)
8> )
9> GO
1>
2>
3> DECLARE @pp_value nvarchar(10);
4> SET @pp_value = "passphrase";
5>
6> SELECT id_data_orig, id_data_enc AS "Encrypted data",
7> CONVERT(nvarchar, DecryptByPassphrase(@pp_value, id_data_enc,
8> 1,
9> CONVERT(varbinary, rowid))) AS "Decrypted data"
10> FROM ForEncDemo
11> WHERE rowid = 1;
12> GO
id_data_orig Encrypted data
Decrypted data
------------ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------- ------------------------------
(0 rows affected)
1> drop table ForEncDemo;
2> GO
1>