Encrypting Columns Using a Passphrase

As our first example, let’s keep things simple and look at how to encrypt a column using a passphrase. To do so, let’s look at the Sales.CreditCard table, which currently stores card numbers in cleartext:

select top 5 * from Sales.CreditCardgo/* ResultCreditCardID CardType       CardNumber     ExpMonth ExpYear ModifiedDate------------ -------------- -------------- -------- ------- -----------1            SuperiorCard   33332664695310 11       2006    2007-08-302            Distinguish    55552127249722 8        2005    2008-01-063            ColonialVoice  77778344838353 7        2005    2008-02-154            ColonialVoice  77774915718248 7        2006    2007-06-215            Vista          11114404600042 ...

Get Microsoft SQL Server 2014 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.