1.去空格
update a set a.mname=Replace(a.mname,CHAR(13) + CHAR(10),'')
from pd_wuliaosprclist a
where a.billno=[cd_master@billno]
update a set a.mname=Replace(a.mname,' ','')
from pd_wuliaosprclist a
where a.billno=[cd_master@billno]
2.数据库插入查询数据
--使用sp_addlinkedserver来增加链接
exec sp_addlinkedserver 'flyerpserver','','SQLOLEDB','192.168.0.15'
exec sp_addlinkedsrvlogin 'flyerpserver','false',null,'readonly','!@yhdcom'
--查看关联关系
exec sp_helpserver
3. 测试库查正式库的数据
insert into cu_askclose
select * from flyerpserver.myerp.dbo.cu_askclose where billno='ALG201909300087'
insert into cu_askcloselist
select * from flyerpserver.myerp.dbo.cu_askcloselist where billno='ALG201909300087'
4.特殊功能
(1)排序:row_number() OVER(order by userno);
(2)排除空格和回车:b5.sprc=REPLACE(REPLACE(REPLACE(REPLACE(b5.sprc,CHAR(10),''),' ',''),' ',''),CHAR(13),'')