Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 varchar vs varbinary for storing encrypted informa

Author  Topic 

iasonas
Starting Member

2 Posts

Posted - 2013-03-12 : 13:04:19
Hello,

I have been looking for pros and cons in storing encrypted information in varchar and varbinary datatypes.
From what I understand, varbinary may have an advantage with the amount of storage it requires to store the same information.
Are there any other differences between the two datatypes that would make one preferable over the other for storing encrypted information?

Thanks,
Jason

robvolk
Most Valuable Yak

15732 Posts

Posted - 2013-03-12 : 13:22:19
Binary is probably easier, SQL Server's built-in encryption features return results as binary. Varchar may offer more options for searching, but typically you don't (or shouldn't) search encrypted data anyway.
Go to Top of Page

iasonas
Starting Member

2 Posts

Posted - 2013-03-12 : 13:32:33
Hi robvolk,

I am encrypting the information before it reaches the database. Does that take away the easier part or are there other reasons apart from the built-in features that would make you say binary is easier?
I would of thought that because varchar is human readable it would be the one that is easier to work with.

Thanks
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2013-03-12 : 13:36:24
It doesn't really matter, if you're already encrypting it before it gets to the database. Frankly, you don't want encrypted data to be readable, and vice versa.
Go to Top of Page
   

- Advertisement -