This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Licensed to the Apache Software Foundation (ASF) under one | |
# or more contributor license agreements. See the NOTICE file | |
# distributed with this work for additional information | |
# regarding copyright ownership. The ASF licenses this file | |
# to you under the Apache License, Version 2.0 (the | |
# "License"); you may not use this file except in compliance | |
# with the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
copy into test_semi_structured | |
from @CDC.PUBLIC.STAGE/ | |
file_format = (type = json STRIP_OUTER_ARRAY = TRUE); | |
select | |
var:tran_begin_time::timestamp as tran_begin_time, | |
var:tran_end_time::timestamp as tran_end_time, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN TRANSACTION; | |
update dbo.TEST set id = 11 where id =9; | |
COMMIT TRANSACTION; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select mapping.tran_begin_time,mapping.tran_end_time,convert(decimal(19,0),src.__$seqval),src.* | |
from cdc.dbo_TEST_CT as src | |
inner join cdc.lsn_time_mapping as mapping | |
on src.__$start_lsn = mapping.start_lsn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN TRANSACTION; | |
update dbo.TEST set COL1 = 'aaa1' where id =1; | |
update dbo.TEST set COL4 = 'dd1' where id =6; | |
update dbo.TEST set COL2 = 'bb3' where id =3; | |
update dbo.TEST set COL3 = 'c1',COL5='e1' where id =1; | |
COMMIT TRANSACTION; | |
select * from dbo.TEST; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update dbo.TEST set COL1 = 'a1' where id =1; | |
update dbo.TEST set COL1 = 'aa1' where id =1; | |
update dbo.TEST set COL1 = 'aa2' where id =2; | |
update dbo.TEST set COL1 = 'aa9' where id =9; | |
select * from dbo.TEST; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select * from cdc.dbo_TEST_CT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO dbo.TEST | |
([ID],[COL1],[COL2],[COL3],[COL4],[COL5],[StartTime],[EndTime]) | |
VALUES | |
(1,'a','b','c','d','e',GETDATE(),GETDATE()), | |
(2,'a2','b2','c2','d2','e2',GETDATE(),GETDATE()), | |
(3,'a3','b3','c3','d3','e3',GETDATE(),GETDATE()), | |
(4,'a4','b4','c4','d4','e4',GETDATE(),GETDATE()), | |
(5,'a5','b5','c5','d5','e5',GETDATE(),GETDATE()), | |
(6,'a6','b6','c6','d6','e6',GETDATE(),GETDATE()), | |
(7,'a7','b7','c7','d7','e7',GETDATE(),GETDATE()), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GO | |
EXEC sys.sp_cdc_enable_table | |
@source_schema = N'dbo', | |
@source_name = N'TEST', | |
@role_name = NULL | |
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GO | |
SELECT [name], is_tracked_by_cdc | |
FROM sys.tables | |
GO |
NewerOlder