22,207
社区成员
发帖
与我相关
我的任务
分享
insert into A.dbo.student([sid],[name],sex,mphone,addr,sfz)
select isnull(xh,'') xh,isnull(xm,'') xm,sex=(case when xb=1 then '男' else '女' end),
isnull(mobilephone,'') lxdh,isnull(LXDZ,'') lxdz,isnull(sfzh,'') sfzh
from OPENDATASOURCE(
'SQLOLEDB',
--'SQLNCLI',
'Data Source=***.***.***.***;User ID=sa;Password=123'
).B.dbo.student as t where t.xh collate Chinese_PRC_CS_AS
not in(select sid from murp.dbo.student)
select max(len(isnull(xh,''))) xh,max(len(isnull(xm,''))) xm,max(sex=(case when xb=1 then '男' else '女' end)),
max(len(isnull(mobilephone,''))) lxdh,max(len(isnull(LXDZ,''))) lxdz,max(len(isnull(sfzh,''))) sfzh
from OPENDATASOURCE(
'SQLOLEDB',
--'SQLNCLI',
'Data Source=***.***.***.***;User ID=sa;Password=123'
).B.dbo.student as t where t.xh collate Chinese_PRC_CS_AS
not in(select sid from murp.dbo.student)