数据库
首页 > 数据库> > sqlserver 库服务器导数据

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

标签:PHYSICIAN,CODE,PHYS,sqlserver,NUM,服务器,ENTERED,数据,ID
来源: https://www.cnblogs.com/chaoshenzhu/p/10838250.html