sys.fn_cdc_map_lsn_to_time (Transact-SQL)
SQL Server 2012
Returns the date and time value from the tran_end_time column in the cdc.lsn_time_mapping system table for the specified log sequence number (LSN). You can use this function to systematically map LSN ranges to date ranges in a change table.
The following example uses the function sys.fn_cdc_map_lsn_to_time to determine the commit time associated with the last change processed in the specified LSN interval for the HumanResources_Employee capture instance.
USE AdventureWorks2012; GO DECLARE @max_lsn binary(10); SELECT @max_lsn = MAX(__$start_lsn) FROM cdc.fn_cdc_get_all_changes_HumanResources_Employee(@from_lsn, @to_lsn, 'all'); SELECT sys.fn_cdc_map_lsn_to_time(@max_lsn); GO