SQL SERVER Encryption
SqlServer 2005 gives a lot of cool encryption features but the easiest one is encryptByPassPhrase.
It is very easy simple and useful too.
Encryption example
In this example the requirement is to encrypt a password using sql commands.
The password is 'Code Factory' and is stored in '@My_Password'.The phrase used here is 'CODE_FACTORY_PHRASE'.
You should use the same phrase in both Encrption and decrption commands.
declare @encryptedstuff VARCHAR(100), @My_Password VARCHAR(20) ,@decryptedstuff VARCHAR(20)
SET @My_Password = 'Code Factory'
SET @encryptedstuff = EncryptByPassPhrase('CODE_FACTORY_PHRASE', @My_Password)
SET @decryptedstuff = DecryptByPassPhrase('CODE_FACTORY_PHRASE', @encryptedstuff)
SELECT ToEncrypt=@My_Password,Encrpted=@encryptedstuff,Decrypted=@decryptedstuff
ResultSet

| Author: |
Aneesh Kuzhikattil |
 |
He is an accomplished IT professional with over 4 years of extensive experience in Microsoft technologies. |