sys.fn_cdc_map_lsn_to_time (Transact-SQL)sys.fn_cdc_map_lsn_to_time (Transact-SQL)

本主題適用於:是SQL Server (從 2008 開始)否Azure SQL Database否Azure SQL 資料倉儲 否平行處理資料倉儲 THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)noAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

傳回的日期和時間值從tran_end_time中的資料行cdc.lsn_time_mapping系統資料表。 指定的記錄序號 (LSN)。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). 您可以使用這個函數,有系統地將 LSN 範圍對應至變更資料表中的日期範圍。You can use this function to systematically map LSN ranges to date ranges in a change table.

主題連結圖示 Transact-SQL 語法慣例Topic link icon Transact-SQL Syntax Conventions


sys.fn_cdc_map_lsn_to_time ( lsn_value )  


這是要比對的 LSN 值。Is the LSN value to match against. lsn_valuebinary (10)lsn_value is binary(10).

傳回類型Return Type



此函式可用來判斷變更已認可為基礎的時間 __ $start_lsn變更資料的資料列中傳回的值。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.


需要 public 角色中的成員資格。Requires membership in the public role.


下列範例會使用 sys.fn_cdc_map_lsn_to_time 函數來判斷與上次變更 (在 HumanResources_Employee 擷取執行個體的指定 LSN 間隔中處理) 相關聯的認可時間。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);  

另請參閱See Also

cdc.lsn_time_mapping (Transact SQL) cdc.lsn_time_mapping (Transact-SQL)
sys.fn_cdc_map_time_to_lsn (Transact-SQL) sys.fn_cdc_map_time_to_lsn (Transact-SQL)
cdc.fn_cdc_get_net_changes_<capture_instance> (Transact-SQL) cdc.fn_cdc_get_net_changes_<capture_instance> (Transact-SQL)
cdc.fn_cdc_get_all_changes_<capture_instance> (Transact-SQL)cdc.fn_cdc_get_all_changes_<capture_instance> (Transact-SQL)