老系统的档案表:old_cparch key:cpcode
字段:
1.cpcode 单位编号 char(8) not null
2.cpname 单位名称 varchar(50) null
3.eccode 经济类型 char(2) null新系统的档案表:new_cparch key:cpcode
字段:
1.cpcode 单位编号 char(8) not null
2.cpname 单位名称 varchar(50) null
3.eccode 经济类型 char(2) null
4.opcode 操作员 char(4) not null迁移时所要做的事,要求如下:
1.操作员编号为“sbor“;
2.单位编号不变;
3.老系统的单位名称为空时,新系统的单位名称标注为单位编号;
4.老系统经济类型为空时,迁移到新系统时标注为‘90’;问:这个用sql语句实现该如何实现?
===================================
我是新手,只会基础的sql,对复杂的不常用的内容不了解,请高手认真回答,谢谢。
字段:
1.cpcode 单位编号 char(8) not null
2.cpname 单位名称 varchar(50) null
3.eccode 经济类型 char(2) null新系统的档案表:new_cparch key:cpcode
字段:
1.cpcode 单位编号 char(8) not null
2.cpname 单位名称 varchar(50) null
3.eccode 经济类型 char(2) null
4.opcode 操作员 char(4) not null迁移时所要做的事,要求如下:
1.操作员编号为“sbor“;
2.单位编号不变;
3.老系统的单位名称为空时,新系统的单位名称标注为单位编号;
4.老系统经济类型为空时,迁移到新系统时标注为‘90’;问:这个用sql语句实现该如何实现?
===================================
我是新手,只会基础的sql,对复杂的不常用的内容不了解,请高手认真回答,谢谢。
Insert into new_cparch(cpcode,cpname,eccode,opcode)
Select cpcode,isNULL(cpname,cpcode),isNULL(eccode.90),'sbor'
from old_cparch
Select cpcode,isNULL(cpname,cpcode),isNULL(eccode,'90'),'sbor'
from old_cparch
cpcode,cpname,eccode,opcode
select
cpcode,isnull(cpname,cpcode),isnull(eccode,'90'),'sbor'
from old_cparch
可能有手误.
(cpcode,cpname,eccode,opcode)
select
cpcode,isnull(cpname,cpcode),isnull(eccode,'90'),'sbor'
from old_cparch