You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Module 4, Ledger Exercise, Exercise 3: Protecting Ledger tables from DDL changes
Issue: Attendee wanted to know who dropped the table in Exercise 3 (aka which login). The principal login for the user that dropped the table is not in the sys.ledger_table_history DMV.
getledgerobjects.sql queries sys.ledger_table_history and sys.ledger_column_history.
Fix:
add the follwing script which joins sys.ledger_table_history. with sys.database_ledger_transactions in order to get the principal_name column from the sys.database_ledger_transactions.
SELECT
t.[principal_name]
, t.[commit_time]
, h.[schema_name] + '.' + h.[table_name] AS [table_name]
, h.[ledger_view_schema_name] + '.' + h.[ledger_view_name] AS [view_name]
, h.[operation_type_desc]
FROM sys.ledger_table_history h
JOIN sys.database_ledger_transactions t
ON h.transaction_id = t.transaction_id
The text was updated successfully, but these errors were encountered:
In Module 4, Ledger Exercise, Exercise 3: Protecting Ledger tables from DDL changes
Issue: Attendee wanted to know who dropped the table in Exercise 3 (aka which login). The principal login for the user that dropped the table is not in the sys.ledger_table_history DMV.
getledgerobjects.sql queries sys.ledger_table_history and sys.ledger_column_history.
Fix:
add the follwing script which joins sys.ledger_table_history. with sys.database_ledger_transactions in order to get the principal_name column from the sys.database_ledger_transactions.

SELECT
t.[principal_name]
, t.[commit_time]
, h.[schema_name] + '.' + h.[table_name] AS [table_name]
, h.[ledger_view_schema_name] + '.' + h.[ledger_view_name] AS [view_name]
, h.[operation_type_desc]
FROM sys.ledger_table_history h
JOIN sys.database_ledger_transactions t
ON h.transaction_id = t.transaction_id
The text was updated successfully, but these errors were encountered: