sys.sp_add_trusted_assembly (Transact-SQL)sys.sp_add_trusted_assembly (Transact-SQL)

适用于: 是SQL Server 2017 和更高版本-azure sql 数据库(仅托管实例)不支持 azure sql数据仓库否并行数据仓库APPLIES TO: yesSQL Server 2017 and later yesAzure SQL Database (Managed Instance only) noAzure SQL Data Warehouse noParallel Data Warehouse

将程序集添加到服务器的受信任程序集的列表中。Adds an assembly to the list of trusted assemblies for the server.

主题链接图标 Transact-SQL 语法约定Topic link icon Transact-SQL Syntax Conventions


    [ @hash = ] 'value'
    [ , [ @description = ] 'description' ]


此过程将程序集添加到sys.databases trusted_assembliesThis procedure adds an assembly to sys.trusted_assemblies.


[ @hash = ]"value"[ @hash = ] 'value'
要添加到服务器的受信任程序集列表的程序集的 SHA2_512 哈希值。The SHA2_512 hash value of the assembly to add to the list of trusted assemblies for the server. 即使程序集未签名或数据库未标记为可信,也可以在启用CLR 严格安全时加载受信任的程序集。Trusted assemblies may load when CLR strict security is enabled, even if the assembly is unsigned or the database is not marked as trustworthy.

[ @description = ]"description"[ @description = ] 'description'
程序集的可选用户定义说明。Optional user-defined description of the assembly. Microsoft 建议使用规范名称对要信任的程序集的简单名称、版本号、区域性、公钥和体系结构进行编码。Microsoft recommends using the canonical name that encodes the simple name, version number, culture, public key, and architecture of the assembly to trust. 此值在公共语言运行时(CLR)端唯一标识程序集,与 sys.databases 中的 clr_name 值相同。This value uniquely identifies the assembly on the common language runtime (CLR) side and is the same as the clr_name value in sys.assemblies.


要求具有固定服务器sysadmin角色或CONTROL SERVER权限的成员身份。Requires membership in the sysadmin fixed server role or CONTROL SERVER permission.


下面的示例将名pointudt为的程序集添加到服务器的受信任程序集的列表中。The following example adds an assembly named pointudt to the list of trusted assemblies for the server. 可以从sys.databases获取这些值。These values are available from sys.assemblies.

EXEC sp_add_trusted_assembly 0x8893AD6D78D14EE43DF482E2EAD44123E3A0B684A8873C3F7BF3B5E8D8F09503F3E62370CE742BBC96FE3394477214B84C7C1B0F7A04DCC788FA99C2C09DFCCC, 
N'pointudt, version=, culture=neutral, publickeytoken=null, processorarchitecture=msil';

另请参阅See Also

sys. sp_drop_trusted_assemblysys.sp_drop_trusted_assembly
sys. trusted_assembliessys.trusted_assemblies
CLR 严格安全性CLR strict security