2020-09-02 13:47:11 -07:00
|
|
|
SELECT DB_NAME() as DatabaseName,
|
|
|
|
|
CONCAT(s.name, '.', t.name) AS TableName,
|
2020-07-31 13:16:04 -07:00
|
|
|
c.name AS ColumnName,
|
2020-09-02 13:39:33 -07:00
|
|
|
ty.Name + '(' + CAST (c.max_length AS VARCHAR (10)) + ')' AS ColumnType,
|
|
|
|
|
cmk.[name] AS CMK_name,
|
|
|
|
|
cmk.create_date AS CMK_createDate,
|
2020-09-21 10:00:14 -07:00
|
|
|
cmk.[key_path] as CMK_path,
|
2020-09-02 13:39:33 -07:00
|
|
|
k.[name] AS CEK_name,
|
|
|
|
|
c.encryption_type_desc
|
2020-07-31 13:16:04 -07:00
|
|
|
FROM sys.columns AS c
|
2020-09-02 13:39:33 -07:00
|
|
|
INNER JOIN sys.types AS ty
|
|
|
|
|
ON c.user_type_id = ty.user_type_id
|
|
|
|
|
INNER JOIN sys.column_encryption_keys AS k
|
|
|
|
|
ON c.column_encryption_key_id = k.column_encryption_key_id
|
|
|
|
|
INNER JOIN sys.tables AS t
|
|
|
|
|
ON c.object_id = t.object_id
|
|
|
|
|
INNER JOIN sys.schemas AS s
|
|
|
|
|
ON t.schema_id = s.schema_id
|
|
|
|
|
INNER JOIN sys.column_encryption_key_values AS cekv
|
|
|
|
|
ON cekv.column_encryption_key_id = k.column_encryption_key_id
|
|
|
|
|
INNER JOIN sys.column_master_keys AS cmk
|
|
|
|
|
ON cekv.column_master_key_id = cmk.column_master_key_id
|
2020-07-31 13:16:04 -07:00
|
|
|
WHERE encryption_type IS NOT NULL;
|