A表和B表字段不同
--insert into B(Name,DepartmentId,DepartmentName,PersonalId,WorkTypeId,CertNumber,CreateTime,Education,IsDel) select Name,DepartId as DepartmentId, (select Name from D where IsDisable = 0 and ID = A.DepartId)as DepartmentName, PersonId as PersonalId, (select id from W where Name = A.JobName) as WorkTypeId, CertNumber as CertNumber, StartDate as CreateTime,--需要转换成datetime类型 ( case ltrim(rtrim(A.Education)) when ‘中专‘ then ‘中职(含技工学校)‘ when ‘大专‘ then ‘专科(含高职和技师学院)‘ when ‘本科‘ then ‘本科及以上‘ when ‘小学‘ then ‘小学‘ when ‘初中‘ then ‘初中‘ when ‘高中‘ then ‘高中‘ when ‘本科及以上‘ then ‘本科及以上‘ else ‘‘ end ) as Education, 0 IsDel from A where id in( select id from A where Isdel=0 and IsChangeCert=0 )
原文地址:https://www.cnblogs.com/xiaonangua/p/11417449.html
时间: 2024-10-29 22:10:10