Friday, August 31, 2012

Security : Encryption and Decryption function in SQL Server

Hi Folks, This is a continuation of my last Blog post. Enjoy.

Before You Start you must have,
- Visual Studio 2005/2008/2010 installed
- MS SQL Server 2005/2008 installed

Step 1: Create an SQL Server Project in Visual Studio

Step 2 : Add a user defined Function

Step 3 : Add the code in my previous blog which Encrypts a string to the user defined function

Step 4 : Add Database reference to the Database which you want to deploy the function

Step 5 : Right Click on the Project and Click Deploy
once deployed you can see the Project has been deployed on your database under.
[Database Name]->Programmability->Assemblies

Step 6 : Use the Functions in SQL Server
Once the Project is deployed you can see the two functions in 
[Database Name]->Programmability->Functions->Scalar-valued Functions

Then they can be used in SQL Server as regular functions.