How to encrypt and decrypt data in SQL Server
—Script
declare @hashkey varchar(100)=’ssunitech’
select BusinessEntityID,
LoginID,ENCRYPTBYPASSPHRASE(@hashkey,cast(LoginID as varchar(100))) LoginID_H,
ENCRYPTBYPASSPHRASE(@hashkey,’ssunitech@123′) as password
Into LoginDetails
from [HumanResources].[Employee]
select *,cast(deCRYPTBYPASSPHRASE(‘ssunitech’,LoginID_H) as varchar(1000)) ,
cast(deCRYPTBYPASSPHRASE(‘ssunitech’,password) as varchar(1000))
from LoginDetails
Find Us On YouTube- “Subscribe Channel to watch Database related videos” https://www.youtube.com/channel/UCZA_5vGtSpZu86VBDdSnSag
For SQL Quiz-
Find Us On FaceBook-
https://www.facebook.com/SS-Unitech-187705388674384/


Comments