????????SQL Server???????????????????г??????SQL Server/MongoDB???????????з???????????????д???????????ù??????????У????3????з????????????????????????·??????????????????????????????????????????SQL Server???е?CDC(change data capture)??????????????????????????????????????????3?????????????????????п??е?????????
????1?????????
????· ????
?????ο????????е?????????Σ??????????ж??????????μ?MongoDB??????????????????С???????????????????????м????????????Ρ??????????????????????????и????????Σ??????и??????????????????????????Ρ?
????· ??????
??????????????????????????????????????MongoDB???????????????????????????????????????Ρ??????????????????????????????????????????????????д?????????????????????????
????· ??????
??????????????????CDC?????MongoDB??????cdc?????л?????????????????????С????迪????????SQL Server???е???????????????????????ù?????????????????????д?????????????????????????????????
?????????????????CDC???????????????С????????????????÷?????????????
????2??CDC????????

????????????????CDC????????????±????SQL Server?????????ɡ?MongoDB(Data warehouse??)?????????????????????????????????Nodejs???????ɡ? ??????alarmos??????aaaaaabbbbbb???????????CDC??????????
????· ????CDC????
????CDC??????????SQL Server?????T-SQL???
????USE alarmos
????GO
????EXEC sys.sp_cdc_enable_db
????GO
??????г????????????????3????cdc?????(schema?cdc)??

????· ?????????
????????????????????????????
????USE alarmos
????GO
????EXEC sys.sp_cdc_enable_table
????@source_schema = 'dbo'??
????@source_name = 'aaaaaabbbbbb'??
????@role_name = 'sa'
????GO
????@source schema??@source name???????????????@role_name????????CDC???????????????????ж????????????г?????????

????· ???????????
??????????????????????????????????????????????T-SQL?????????????fn cdc get all changes dbo aaaaaabbbbbb()???????????????????(??????????????????)????????ú??????????????????
????USE alarmos
????select @begin_lsn = sys.fn_cdc_get_min_lsn('dbo_aaaaaabbbbbb)
????select @end_lsn = sys.fn_cdc_get_max_lsn()
????select * from cdc.fn_cdc_get_all_changes_dbo_Customer(@begin_lsn?? @end_lsn?? 'all');
??????????????????????2???????????2??????????????????