Thursday, 26 December 2019

Encrypt password in SQL Server

This post will show you how can you encrypt/decrypt the password in SQL server 2012 fully using SQL Server store procedure.

Encrypt



        INSERT INTO AdminMaster ( Name,  UserName, Password, Status)

        VALUES('Girfa', 'girfa',EncryptByPassPhrase('key', '123')  , 1)


Decrypt


SELECT         Name,   UserName, convert(char,DecryptByPassPhrase('key',Password )) as password, Status
FROM            dbo.Login

Password view


SELECT         Name,   UserName, convert(char,DecryptByPassPhrase('key',Password )) as password, Status
FROM            dbo.Login





No comments:

Post a Comment