sqlserver 库服务器导数据

EXEC sys.sp_addlinkedserver '93SERVER', '', 'SQLOLEDB', '101.201.142.93';
EXEC sys.sp_addlinkedsrvlogin '93SERVER', 'false', NULL, 'sa', 'KnrtPp123SqlSa';

--远程查询
SELECT * FROM [93SERVER].[hr_zzqy20181228].[dbo].code WHERE code_type = 'HIS_DEPARTMENT'
--将远程数据导入本地
INSERT INTO code (FACILITY_ID,CODE_TYPE,CODE_VALUE,CODE_DESC,ENTERED,ENTERED_BY,VERSION_NUM,PARENT_CODE_ID,OBSOLETE_YN,MISC_VALUE1) SELECT FACILITY_ID,CODE_TYPE,CODE_VALUE,CODE_DESC,ENTERED,ENTERED_BY,VERSION_NUM,PARENT_CODE_ID,OBSOLETE_YN,MISC_VALUE1 FROM [93SERVER].[hr_zzqy20181228].[dbo].code WHERE code_type = 'HIS_DEPARTMENT'

INSERT INTO PHYSICIAN (PHYS_NAME, HIN_PHYS_IDENT, PHYS_REGISTRATION_IDENT, ENTERED, ENTERED_BY, VERSION_NUM, FACILITY_ID, PHYS_CLASS, IP_ADDRESS, TIP_CLOSE_TIME, TELEPHONE, ABX_PRESCRIBE_RIGHT, JM_FLAG, DEPARTMENT_NAME, PHYSICIAN_JOB, PHYSICIAN_POST, CHESTCARD_NO, IDCARD_NO, PHYSICIAN_GENDER, PHYSICIAN_DOB, FLAG, HEARTBEAT_TIME, MAC_ADDRESS, LOGIN_NUM) SELECT PHYS_NAME, HIN_PHYS_IDENT, PHYS_REGISTRATION_IDENT, ENTERED, ENTERED_BY, VERSION_NUM, FACILITY_ID, PHYS_CLASS, IP_ADDRESS, TIP_CLOSE_TIME, TELEPHONE, ABX_PRESCRIBE_RIGHT, JM_FLAG, DEPARTMENT_NAME, PHYSICIAN_JOB, PHYSICIAN_POST, CHESTCARD_NO, IDCARD_NO, PHYSICIAN_GENDER, PHYSICIAN_DOB, FLAG, HEARTBEAT_TIME, MAC_ADDRESS, LOGIN_NUM FROM [93SERVER].[hr_zzqy20181228].[dbo].PHYSICIAN

上一篇:论meta name= viewport content= width=device-width initial-scale=1 minimum-scale=1 maximum-scale=1的作用


下一篇:python小黑屋