Hello Folks,

You would have heard about Cell-Level Encryption which was introduced earlier with the arrival of SQL Server 2005. It was built for the developers with a granular level of encryption for their applications that have specific data security requirements.

While on the other side, SQL Server Column Level Encryption provides much flexibility in terms of performance and space costs. The main difference between the Column-Level Encryption and Cell-Level Encryption is that the expense of column-level encryption is magnified by the number of rows in the table.

There are some pre-requisites before using Column-Level or Cell-Level Encryption please go through it:

  • Column to be encrypted in the table schema should be stored as varbinary object.
  • It requires additional processing and disk space overhead.
  • The performance cost will be more while converting the data to and from a varbinary type.

It will become much clear to you, if you follow the example carefully:

First, I will let you know that how to encrypt the column which has values stored in it.


Here, I have created a table name “Student” inside “School” database.

In the above table, S_PhoneNumber_SSN is a Plain-text column, while S_PhoneNumber_SSN_asym is a Encypted column.

Now, it’s time to create the simple asymmetric key to use for encrypting the “S_PhoneNumber_SSN_asym” column as mentioned above:

So, as to see the result, we have to insert some values:

Let see the table now:


As you can see from the above, that S_PhoneNumber_SSN_asym is being encrypted into a non-readable format.

Therefore, it’s the right time now to show that how to decrypt the above encrypted code.

Write the following code to decrypt the above data:

It can be seen as:


Well, this was about Column-Level Encryption and Decryption from my side.

Please do comment on this :)



Piyush Bajaj

Like us on FaceBook Follow us on Twitter | Join the fastest growing SQL Server group on FaceBook

Follow me on Twitter  |  Follow me on FaceBook