批量运维SQl生成,可以用EXCEl,也可以SQL查询生成

时间:2023-03-08 19:34:46
批量运维SQl生成,可以用EXCEl,也可以SQL查询生成
select  'insert into Base_VehiclesInformation (ID,CarModelID,FistRegTime,ScrappageDate,
Creator,CreateTime,LastModifier,LastModifyTime,CustType,Enable,flag,OpCompany,
Source,IfLVehicle,IsAutoInsert,PRI,IsAuth,IsInputBDEVR,RealTimeDataSource,IfShare,
VehicleMonitorSign,IsAutoCharge,IfDeliveryOperation ,RegAddr,
CarType,CarNo,CarLicense,EngineNo)
select NEWID(),''e3cb0e32-443c-4f97-aad7-7a998964cc51'',''2019-02-20 00:00:00.000'',
''1900-01-01 00:00:00.000'',''gaojf'',''2019-02-20 16:06:14.740'',''gaojf'',''2019-02-20 16:06:14.740'',''1'',
''1'',''1'',''fb247fb4-13d1-4c1b-acf8-27278b9bd0b1'',''2'',''1'',''0'',
''5'',''0'',
''1'',''1'',''0'',''0'',''2'',''0'',''1101'',''3'','''+cme.EvcInfo_CarNo+''','''+REPLACE(cme.evcInfo_carLicense,'·','')+''','''+isnull(cme.EvcInfo_EngineNo,'')+''''
from CM_EvcInfo cme
where cme.EvcInfo_CarNo like 'LVCB4L4%'
and cme.EvcInfo_CarNo NOT IN (
SELECT cme1.EvcInfo_CarNo
FROM CM_EvcInfo cme1
WHERE cme1.EvcInfo_RegAdd LIKE 'A891BF09-DC2E-47F9-B5D1-76D7CD579CBD' )
AND NOT EXISTS(SELECT CarNo FROM [dbo].[CarInfo201902202$] WHERE CarNo=cme.EvcInfo_CarNo)

  

EXCEl方式:找到需要修改的字段,变成列格式,再经行处理