# Usage example

The following SQL statement returns a range of changes from the last handled event (of change sequence "20240723144522110000000000000901203") until the event committed on 23-Jul-2024 at 23:00:00.00. For update operations, the before image value (in this example, the salary before and after) is also returned.

SELECT CHANGE.[header\_\_change\_seq],

CHANGE.[header\_\_stream\_position],

CHANGE.[header\_\_operation],

CHANGE.[header\_\_transaction\_id],

CHANGE.[header\_\_timestamp],

CHANGE.[EMPLOYEE\_ID],

CHANGE.[FIRST\_NAME],

CHANGE.[LAST\_NAME],

CHANGE.[SALARY],

BI.[SALARY],

FROM [Replication].[HR].[EMPLOYEES\_ct] CHANGE LEFT OUTER JOIN

[Replication].[HR].[EMPLOYEES\_ct] BI ON

BI.[header\_\_change\_seq] = CHANGE.[header$\_\_change\_seq] AND

BI.[header\_\_change\_oper] = 'B'

WHERE CHANGE.header\_\_oper &lt;&gt; 'B' AND

CHANGE.[header\_\_stream\_position] &gt; '20120723144522110000000000000901203' AND

CHANGE.[header\_\_stream\_position] &lt;= '2012072323000000Z' AND

ORDER BY

CHANGE.[header\_\_stream\_position], CHANGE.[header$\_\_stream\_oper]