/*
--Synchronizing readers
INSERT into [172.21.200.8].gdlisxp.dbo. Reader Library (library card number, reader barcode, name, gender, ID number,
reader level, level Code, Unit Code, Unit, debit, issuing date, expiration date, ethnicity, reservation information)
Select Xs.sfzh,xs.sfzh,xs. XM,
(case XS. XBM when ' 1 ' then ' Male ' when ' 2 ' then ' women ' else ' end ' as Xb,xs.sfzh, ' student ', ' B ',
DW. Unit code, ' +zy.zymc,20 ', ' 2014-09-16 18:00:00 ' as issuing date, ' 2034-09-16 18:00:00 ' as expiration date,
dm.value, ' 20140916 batch sync '
From XS0101 as XS
Left join jx01 as Zy on ZY.ZYBH=XS.ZYBH
Left joins Hb_dmzd as DM on dm.lxdm= ' MZM ' and DM. GBM=XS.MZM
Left joins Jp_temp as JP on JP. Ksh=xs.ksh
Left join [172.21.200.8].gdlisxp.dbo. Reader unit as DW on DW. Unit name = ' + ' +ZY.ZYMC
where Xs.ksh like ' 14% ' and Xs.sfzh not in (select Reader bar code from [172.21.200.8].gdlisxp.dbo. Reader library)
* * indicates that the reader information from the local database is synchronized to the reader information on the 172.21.200.8
Scripts for SQL Server synchronization tables