CHANGE TRACKING SYSTEM -HOW IT IS WORK CHAPTER 2

SELECT *
from changetable(changes employee, 1) as ct
INNER JOIN employee pn on pn.EmployeeID = CT.EmployeeID
WHERE SYS_CHANGE_VERSION > 1 and CT.Sys_Change_Operation <> 'D'

Resultset:

SYS_CHANGE_VERSION
SYS_CHANGE_CREATION_VERSION
SYS_CHANGE_OPERATION
SYS_CHANGE_COLUMNS
SYS_CHANGE_CONTEXT
EmployeeID
FirstName
LastName
Phone1
26
27
U
0x0000000004000000
NULL
E001
Santosh
Poojari
12121212
27
27
U
0x0000000004000000
NULL
E002
Karan
Shah
21212121

The SYS_CHANGE_OPERATION column provides the information what happened to this record “U” stats that it was modified.
Let's do and insert and see what the resultset would look like:




http://www.codeproject.com/Articles/338183/SQL-Server-Change-Tracking-on-Table-Without-Trigge

Comments