Skip to main content

Usage example

The following SQL statement returns a range of changes that starts after the last handled event (of change sequence "20120723144522110000000000000901203") and until the event committed on 23-Jul-2012 at 23:00:00.00. For update we also get the before image value (here for the salary before and after).

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 <> 'B' AND

CHANGE.[header__stream_position] > '20120723144522110000000000000901203' AND

CHANGE.[header__stream_position] <= '2012072323000000Z' AND

ORDER BY

CHANGE.[header__stream_position], CHANGE.[header$__stream_oper]

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!