SQL中如何使用IF语句
SQL中如何使用IF语句execsp_addlinkedserver'PCWLGD','','SQLOLEDB','127.0.0.1'goexecsp_addlinke...
SQL中如何使用IF语句
exec sp_addlinkedserver 'PCWLGD', ' ', 'SQLOLEDB ', '127.0.0.1'
go
exec sp_addlinkedsrvlogin 'PCWLGD', 'false ',null, 'sa', 'zxcvbnm'
go
use UFTData497882_500000
set identity_insert LX_T_Loadometer ON
insert into LX_T_Loadometer ( Id,ddate,vouchertype,ldmethod,code,VehicleNo,idPartner,idInventory,idWareHouse,UserName1,UserName2,Unit,GrossWeight,Tare,NetWeight,Fee,Price,Totle,Paid,Memo,LTime,TimeConsuming,ToVercherType,ToVercherId,ToVercherCode,paraId1,paraId2,Checker,CheckDate,voider,voiddate,OrderDetailId,OrderType,OrderCode,OrderID,PrintCount,priuserdefined1,priuserdefined2,priuserdefined3,priuserdefined4,DataSource,WaterRatio,ImpurityRatio,Fee2,ActualWeight,priuserdefined5,lddefdecm1,lddefdecm2,lddefdecm3,lddefdecm4,lddefdecm5,BarCode,cModifyPerson,cModifyDate,idReservedVoucher,ReservedVoucherCode,DisCode,FirstAutoVehicleNo,SecondAutoVehicleNo,Creater,CreatedTime,Confirmor,ConfirmTime,Confirmdevid)
select Id,ddate,vouchertype,ldmethod,code,VehicleNo,idPartner,idInventory,idWareHouse,UserName1,UserName2,Unit,GrossWeight*0.9,Tare,GrossWeight*0.9-Tare,Fee,Price,Totle,Paid,Memo,LTime,TimeConsuming,ToVercherType,ToVercherId,ToVercherCode,paraId1,paraId2,Checker,CheckDate,voider,voiddate,OrderDetailId,OrderType,OrderCode,OrderID,PrintCount,priuserdefined1,priuserdefined2,priuserdefined3,priuserdefined4,DataSource,WaterRatio,ImpurityRatio,Fee2,GrossWeight*0.9-Tare,priuserdefined5,lddefdecm1,lddefdecm2,lddefdecm3,lddefdecm4,lddefdecm5,BarCode,cModifyPerson,cModifyDate,idReservedVoucher,ReservedVoucherCode,DisCode,FirstAutoVehicleNo,SecondAutoVehicleNo,Creater,CreatedTime,Confirmor,ConfirmTime,Confirmdevid from PCWLGD.UFTData587583_600778.dbo.LX_T_Loadometer as a
where a.Id not in (select Id from LX_T_Loadometer )
其中不是所有数据都要马上复制过来. 要等到这一行数据的其中一列出现的数据才复制过来.请问 怎么写代码 展开
exec sp_addlinkedserver 'PCWLGD', ' ', 'SQLOLEDB ', '127.0.0.1'
go
exec sp_addlinkedsrvlogin 'PCWLGD', 'false ',null, 'sa', 'zxcvbnm'
go
use UFTData497882_500000
set identity_insert LX_T_Loadometer ON
insert into LX_T_Loadometer ( Id,ddate,vouchertype,ldmethod,code,VehicleNo,idPartner,idInventory,idWareHouse,UserName1,UserName2,Unit,GrossWeight,Tare,NetWeight,Fee,Price,Totle,Paid,Memo,LTime,TimeConsuming,ToVercherType,ToVercherId,ToVercherCode,paraId1,paraId2,Checker,CheckDate,voider,voiddate,OrderDetailId,OrderType,OrderCode,OrderID,PrintCount,priuserdefined1,priuserdefined2,priuserdefined3,priuserdefined4,DataSource,WaterRatio,ImpurityRatio,Fee2,ActualWeight,priuserdefined5,lddefdecm1,lddefdecm2,lddefdecm3,lddefdecm4,lddefdecm5,BarCode,cModifyPerson,cModifyDate,idReservedVoucher,ReservedVoucherCode,DisCode,FirstAutoVehicleNo,SecondAutoVehicleNo,Creater,CreatedTime,Confirmor,ConfirmTime,Confirmdevid)
select Id,ddate,vouchertype,ldmethod,code,VehicleNo,idPartner,idInventory,idWareHouse,UserName1,UserName2,Unit,GrossWeight*0.9,Tare,GrossWeight*0.9-Tare,Fee,Price,Totle,Paid,Memo,LTime,TimeConsuming,ToVercherType,ToVercherId,ToVercherCode,paraId1,paraId2,Checker,CheckDate,voider,voiddate,OrderDetailId,OrderType,OrderCode,OrderID,PrintCount,priuserdefined1,priuserdefined2,priuserdefined3,priuserdefined4,DataSource,WaterRatio,ImpurityRatio,Fee2,GrossWeight*0.9-Tare,priuserdefined5,lddefdecm1,lddefdecm2,lddefdecm3,lddefdecm4,lddefdecm5,BarCode,cModifyPerson,cModifyDate,idReservedVoucher,ReservedVoucherCode,DisCode,FirstAutoVehicleNo,SecondAutoVehicleNo,Creater,CreatedTime,Confirmor,ConfirmTime,Confirmdevid from PCWLGD.UFTData587583_600778.dbo.LX_T_Loadometer as a
where a.Id not in (select Id from LX_T_Loadometer )
其中不是所有数据都要马上复制过来. 要等到这一行数据的其中一列出现的数据才复制过来.请问 怎么写代码 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询