Data in certain fields in a table needs to be encrypted and later on decrypted to be used in sp. What should be the appropriate data type that can be used so that the same column can hold both the encrypted form and decrypted form of data?

The requirement is that the data in certain columns need to be encrypted after data is loaded and later on need to be decrypted so that these values can be used in calculations in a stored proc. My questions are :- Do I add new columns to the existing table to hold encrypted data in varbinary or something? What can be the appropriate data type that can hold both the encrypted value and the value after decryption in the same column?

more ▼

asked Apr 18 at 05:29 AM in Default

sumitava20 gravatar image

1 1

Also please suggest how can I approach this problem of encryption ?? Do i move out these fields in separate tables? Will it help me in any way ?? I will be grateful if I can get some quick suggestions on this?
Apr 18 at 05:32 AM sumitava20
you may also wish to combine this question with your original question in the form of a comment.
Apr 21 at 07:14 AM nidheesh.r.pillai
please post this question in the default section and not the meta-askssc section.
Apr 21 at 07:13 AM nidheesh.r.pillai
Moved to Default section.
Apr 21 at 08:26 AM Dave_Green ♦
(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first
If you're going to encrypt individual columns (not something I've done personally), I've always seen it done as binary storage.
more ▼

answered Apr 22 at 10:05 AM

Grant Fritchey gravatar image

Grant Fritchey ♦♦
103k 19 21 74

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Apr 18 at 05:29 AM

Seen: 286 times

Last Updated: Apr 22 at 10:05 AM