From the course: SQL Server 2014 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Encrypting data

Encrypting data - SQL Server Tutorial

From the course: SQL Server 2014 Essential Training

Start my 1-month free trial

Encrypting data

- In this section, I'd like to talk about another facet of security, and that is encryption. We're gonna see how to encrypt some data in a database. If we open up the AdventureWords2014 database, and then open up Tables, and scroll down a little bit, we'll see a table called Sales.CreditCard. I'll right click on that, and do Select Top 1000 Rows, and we'll see in the result set, some unencrypted credit card numbers, and that's not a best practice, we don't want to store that data unencrypted. First we're gonna alter that table to add one more column to it, and we'll use that column to store the encrypted data. So the command is ALTER TABLE, and then we'll need to state the name of the table we would like to alter, in this case, Sales.CreditCard. And we're gonna ADD one column. I'm gonna set the name of that column to CardNumber_Encrypted. The data type for encrypted columns, is always var binary, meaning a variable length binary string, and I'll set the length to 255. We'll need to…

Contents