Operational Defect Database

BugZero found this defect 1308 days ago.

Microsoft SQL Server | 10982548

KB4046918 - FIX: Execution fails when a SQL CLR function invokes Transact-SQL statements through impersonation calls in SQL Server 2016 and 2017 - Microsoft Support

Last update date:

7/24/2023

Affected products:

SQL Server 2017 on Windows (all editions)

SQL Server 2016 Enterprise Core - duplicate (do not use)

SQL Server 2016 Standard - duplicate (do not use)

SQL Server 2016 Developer - duplicate (do not use)

SQL Server 2016 Enterprise - duplicate (do not use)

Affected releases:

build lower than 14.0.3006.16

Fixed releases:

14.0.3006.16

Description:

Symptoms

Consider the following scenario: You have a SQL CLR function in SQL Server 2016 and 2017. The CLR function invokes Transact-SQL statements through impersonation calls, such as by calling the EXECUTE AS statement. In this scenario, the execution fails, and you receive the following error message: Msg 6522, Level 16, State 1, Procedure PrcedureName, Line 0 [Batch Start Line LineNumber] A .NET Framework error occurred during execution of user-defined routine or aggregate "ProcedureName": System.Data.SqlClient.SqlException: The server principal "LoginName" is not able to access the database "DatabaseName" under the current security context.

Resolution

This fix is included in Cumulative Update 1 for SQL Server 2017. Service pack information for SQL Server 2016 This issue is fixed in the following service pack for SQL Server:        Service Pack 2 for SQL Server 2016

About SQL Server 2017 builds

Each new build for SQL Server 2017 contains all the hotfixes and security fixes that were in the previous build. We recommend that you install the latest build for SQL Server 2017.

Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

Unavailable

Learn More

Search:

...