Was this page helpful?
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

sys.fn_cdc_map_lsn_to_time (Transact-SQL)


Applies To: SQL Server 2014, SQL Server 2016 Preview

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.

Applies to: SQL Server (SQL Server 2008 through current version).

Topic link icon Transact-SQL Syntax Conventions

sys.fn_cdc_map_lsn_to_time ( lsn_value )


Is the LSN value to match against. lsn_value is binary(10).


This function can be used to determine the time that a change was committed based upon the __$start_lsn value returned in the row of change data.

Requires membership in the public role.

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;
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);
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft