2017-10-09 108 views

回答

2

它工作在我的环境:

enter image description here

我想我也有类似的问题,因为我没有使用最新的SQL Server Management Studio。你可以找到最新版本here

生成的代码看起来是这样的 - 我认为你可以改变它,尝试,如果你不能保存为PS脚本:

# Generated by SQL Server Management Studio at 9:15 AM on 2017-10-09 

Import-Module SqlServer 
# Set up connection and database SMO objects 

$sqlConnectionString = "Data Source=SQLInstanceName\INST1;Initial Catalog=databaseName;Integrated Security=True;MultipleActiveResultSets=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;Packet Size=4096;Application Name=`"Microsoft SQL Server Management Studio`"" 
$smoDatabase = Get-SqlDatabase -ConnectionString $sqlConnectionString 

# If your encryption changes involve keys in Azure Key Vault, uncomment one of the lines below in order to authenticate: 
# * Prompt for a username and password: 
#Add-SqlAzureAuthenticationContext -Interactive 

# * Enter a Client ID, Secret, and Tenant ID: 
#Add-SqlAzureAuthenticationContext -ClientID '<Client ID>' -Secret '<Secret>' -Tenant '<Tenant ID>' 

# Change encryption schema 

$encryptionChanges = @() 

# Add changes for table [dbo].[TablenameX] 
$encryptionChanges += New-SqlColumnEncryptionSettings -ColumnName dbo.TablenameX.columNameX -EncryptionType Deterministic -EncryptionKey "CEK_Auto1" 

Set-SqlColumnEncryption -ColumnEncryptionSettings $encryptionChanges -InputObject $smoDatabase 

的SQL版本是:

Microsoft SQL Server 2016 (SP1) (KB3182545) - 13.0.4001.0 (X64) Oct 28 2016 18:17:30 Copyright (c) Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2012 R2 Standard 6.3 (Build 9600:) (Hypervisor)

而且SSMS版本是Microsoft SQL Server Management Studio 14.0.17177.0 - 或来自我提供的链接的v17.2。

+0

谢谢你,如果我可以在SSMS 2016下进行测试,我会保持你的发布,因为这个实例实际上是MS SQL 13(2016)。 –

+0

请注意,现在SSMS的安装不是SQL Server安装的一部分。您可以从链接免费下载文件并安装它 - 有两个版本的SSMS也可以。 – gotqn

+0

老兄,我可以问你的实例版本(SQL服务器)和你的SSMS版本吗?即时通讯使用SSMS 2016,但仍然获得相同的行为@gotqn –

相关问题