January 23, 2024

Is external governance coming to SQL Server 2022?!?!

Every so often, when a new cumulative update (CU) comes out for SQL Server, I like to see what system objects are new and which ones have changed. With the cumulative SQL Server 2022 update eleven this month, I noticed some exciting views not documented in the release notes. I figured I would blog about them and the process I used to identify them. If you didn’t look at the title of this post, they are related to external governance 🙂

New Views In SQL Server 2022 CU11

Don’t just take my word for it. Here are the new views added. Here is an image showing new or modified views. A little later, I will show you how you can find these yourself below.

NOTE: As of January 23rd, 2023, the Microsoft Release notes for Cumulative Update 11 with SQL Server 2022 do not include anything relating to external governance.

External Governance Might Be Coming to SQL Server 2022.

How to Find New or Updated Objects with Cumulative Updates

In this six-minute video, I explain cumulative updates with SQL Server. More importantly, I will show you how I get nosy and check whether views or modules were added or changed.

Learn why Cumulative Updates are important and how they benefit you. Also, learn how to be a detective and see if other updates occurred that might be missing in the release notes.

How Do I Know When Cumulative Updates Are Released?

Microsoft shares the latest updates and version history on their website. I recommend using Visual Ping to notify you when the update page changes.

Scraping System Views After Update is Applied

Here is a script I would use to pull data after applying the update. You can pull more or less, but here is some of the data I looked at to see what has changed in the system views and objects.

use [procuresql]
go
-- New Minor verision number for SQL 2022 CU11 is 4105 --
CREATE SCHEMA [4105] AUTHORIZATION dbo;
GO

USE [master];
go

select * INTO [ProcureSQL].[4105].all_sql_modules From sys.all_sql_modules
select * INTO [ProcureSQL].[4105].all_views FROM sys.all_views
select * INTO [ProcureSQL].[4105].all_columns FROM sys.all_columns
select * INTO [ProcureSQL].[4105].all_objects FROM sys.all_objects
select * INTO [ProcureSQL].[4105].all_parameters FROM sys.all_parameters

SELECT * INTO [ProcureSQL].[4105].assemblies FROM sys.assemblies
SELECT * INTO [ProcureSQL].[4105].assembly_files FROM sys.assembly_files
SELECT * INTO [ProcureSQL].[4105].assembly_modules FROM sys.assembly_modules
SELECT * INTO [ProcureSQL].[4105].assembly_references FROM sys.assembly_references
SELECT * INTO [ProcureSQL].[4105].assembly_types FROM sys.assembly_types
SELECT * INTO [ProcureSQL].[4105].asymmetric_keys FROM sys.asymmetric_keys
select * INTO [ProcureSQL].[4105].spt_values from master.dbo.spt_values

use [msdb]
go
select * INTO [ProcureSQL].[4105].mssqldb_views from sys.views
order by name

Suppose you pulled the same System data for cumulative update ten (CU10), minor number 4035, before applying the cumulative update eleven. We could compare the differences between the modules, views, objects, etc…

Using the free data comparison we provided in a previous blog post, we can see modules that are either new, removed, or changed between CU11 and CU10.

/* What modules are new or different? */
DROP TABLE IF EXISTS #tmp1
DROP TABLE IF EXISTS #tmp2

SELECT o.name AS ObjName, o.[type_desc] 
INTO #tmp1 
FROM [4105].all_sql_modules m join [4105].all_objects o on m.object_id=o.object_id
EXCEPT
SELECT o.name AS ObjName, o.[type_desc] 
FROM [4035].all_sql_modules m join [4035].all_objects o on m.object_id=o.object_id

SELECT o.name AS ObjName, o.[type_desc] 
INTO #tmp2 
FROM [4035].all_sql_modules m join [4035].all_objects o on m.object_id=o.object_id
EXCEPT
SELECT o.name AS ObjName, o.[type_desc] 
FROM [4105].all_sql_modules m join [4105].all_objects o on m.object_id=o.object_id

SELECT ObjName, [type_desc] FROM #tmp1
UNION ALL
SELECT ObjName, [type_desc] FROM #tmp2
order by ObjName

DROP TABLE IF EXISTS #tmp1
DROP TABLE IF EXISTS #tmp2

What is External Governance?

Good question; if you look at the image above, you will notice several new Microsoft shipped views (is_ms_shipped = 1). These views are related to external governance.

My educated guess is that you can add or import external 3rd party sources to help you discover, classify, label & report the sensitive data in your databases. Here is a guide if you are new to data discovery and clarification with SQL Server.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.