I have encrypted a table column and I want to display data decrypt data.
I have used below query to encrypt data. I need your help to how I can display data as it is in real.
- OPEN SYMMETRIC KEY CreditCards_Key11
- DECRYPTION BY CERTIFICATE Sales09;
- UPDATE Sales.CreditCard
- SET CardNumber_Encrypted = EncryptByKey(Key_GUID('CreditCards_Key11')
- , CardNumber, 1, HashBytes('SHA1', CONVERT( varbinary
- , CreditCardID)));
- GO
- SELECT CustomerID
- AS 'Encrypted ID Number',
- CONVERT(nvarchar, DecryptByKey(CustomerID))
- AS 'Decrypted ID Number'
- FROM tblCustomer
- GO
- CLOSE SYMMETRIC KEY UniqueCUSTOMERID
and the output is :-

Bineeshcp Viswanath125 reputationPosted Mar 4, 2019, 7:41 PM EST
I have done the below query and I can able to decrypt the data.
Bineeshcp Viswanath125 reputationPosted Mar 3, 2019, 11:36 PM EST
Sanwar RanwaRank #23 · 44.7K reputationPosted Mar 4, 2019, 12:16 AM EST
Jignesh KumarRank #91 · 22.9K reputationPosted Mar 5, 2019, 4:51 AM EST
Sanwar RanwaRank #23 · 44.7K reputationPosted Mar 3, 2019, 11:02 PM EST
Vivek KumarRank #272 · 9.3K reputationPosted Mar 4, 2019, 8:31 AM EST