语句是这样的。
CREATE TABLE CCC
(
ID_NO VARBINARY(MAX) NOT NULL,
NAME NVARCHAR(20),
S_NO VARBINARY(MAX) NOT NULL
)
GO
--加密
INSERT into CCC(ID_NO,NAME,S_NO)
SELECT
EncryptByPassPhrase('ID_NO','被加密的ID_NO'),
'張三',
EncryptByPassPhrase('S_NO','被加密的S_NO')
--解密
Select ID_NO,NAME,S_NO,
cast(DecryptByPassPhrase('ID_NO',ID_NO) as nvarchar(max)) as 'ID_NO解密',
cast(DecryptByPassPhrase('S_NO',S_NO) as nvarchar(max)) AS 'S_NO解密'
From CCC
GO
查询后,解密的内容不正确呀。