Clarifications on sql 2016 Always encyptions

  • Hi Experts,

    Question1)
    Can I un-encrypt/remove encryption on a column which has always encypted turned on and has some data?
    We are using a powershell command to turn on encryption. do we have option to turn off?

    Currently we are doing encyption using below powershell commands
     $encryptionChanges = @()
     $encryptionChanges += New-SqlColumnEncryptionSettings -ColumnName dbo.Customer.SSN -EncryptionType Deterministic -EncryptionKey $cekName
     $encryptionChanges += New-SqlColumnEncryptionSettings -ColumnName dbo.Customer.City -EncryptionType Deterministic -EncryptionKey $cekName
     Set-SqlColumnEncryption -ColumnEncryptionSettings $encryptionChanges -InputObject $database


    Question2)
    Suppose my always encrypted column length is varchar(10) now I wanted to increase the length or decrease the column using alter stmt,
    Can we do that or any limitations around that?

    Question3)

    I have a table with 3 columns say c1,c2,c3 and table has say 100 rows in it.
    Now Can i extra columns to the table , drop the encrypted column ? Can we do that?

    Thanks,

    Sam

  • vsamantha35 - Wednesday, April 4, 2018 11:19 AM

    Question1)
    Can I un-encrypt/remove encryption on a column which has always encypted turned on and has some data?
    We are using a powershell command to turn on encryption. do we have option to turn off?

    Currently we are doing encyption using below powershell commands
     $encryptionChanges = @()
     $encryptionChanges += New-SqlColumnEncryptionSettings -ColumnName dbo.Customer.SSN -EncryptionType Deterministic -EncryptionKey $cekName
     $encryptionChanges += New-SqlColumnEncryptionSettings -ColumnName dbo.Customer.City -EncryptionType Deterministic -EncryptionKey $cekName
     Set-SqlColumnEncryption -ColumnEncryptionSettings $encryptionChanges -InputObject $database

    Encryption can be removed, have you read the KBs available on the Microsoft website?

    vsamantha35 - Wednesday, April 4, 2018 11:19 AM


    Question2)
    Suppose my always encrypted column length is varchar(10) now I wanted to increase the length or decrease the column using alter stmt,
    Can we do that or any limitations around that?

    Why you are modifying the column definition at this point would be questionable, it has ramifications on any objects that reference the column to insert data.
    Have you read the freely available KBs on technet

    vsamantha35 - Wednesday, April 4, 2018 11:19 AM


    Question3)

    I have a table with 3 columns say c1,c2,c3 and table has say 100 rows in it.
    Now Can i extra columns to the table , drop the encrypted column ? Can we do that?

    adding columns to the table would follow usual restrictions, dropping the encrypted column or just removing the encryption?

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • (1) you can. https://blogs.msdn.microsoft.com/staltam/2017/04/05/how-to-disable-always-encrypted-feature/
    (2) I think we can increase, but can NOT decrease directly.
    (3) Yes, no problem

    GASQL.com - Focus on Database and Cloud

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply