SQL Server/T-SQL Tutorial/System Functions/EncryptByPassPhrase
Версия от 13:46, 26 мая 2010; (обсуждение)
EncryptByPassPhrase function
4> CREATE TABLE ForEncDemo (
5> rowid int IDENTITY(1,1) PRIMARY KEY,
6> name nvarChar(20),
7> id_data_orig Nvarchar(11),
8> id_data_enc varbinary(70)
9> )
10> GO
1>
2> DECLARE @name nvarchar(20), @in_id_data nvarchar(70)
3>
4> SET @name = "Red"
5> SET @in_id_data = "111-11-1111"
6> INSERT ForEncDemo (name, id_data_orig) VALUES(@name, @in_id_data)
7> GO
1>
2> DECLARE @pp_value nvarchar(10)
3>
4> SET @pp_value = "passphrase"
5>
6> UPDATE ForEncDemo
7> SET id_data_enc = EncryptByPassPhrase(@pp_value, id_data_orig,
8> 1,
9> CONVERT(varbinary, rowid))
10> WHERE rowid = 1
11> GO
1>
2> drop table ForEncDemo;
3> GO
1>