导入表信息
来源:互联网 发布:制作伴奏软件 编辑:程序博客网 时间:2024/05/29 14:04
update xs1 set 运销类型 = 1 where 运销类型 = '调运'
update xs1 set 运销类型 = 0 where 运销类型 = '销售'
insert into cars(chepai,chexing,yanse,pizhong,zaizhong,chezhu,dianhua,leixing)
select 车牌号,车型,颜色,皮重,载重,车主名称,车主联系方式,运销类型 from xs1;
update cars set jihuo = 1,contractNum = 0,selected = 0,del = 0,remark = '';
/*更新皮重*/
use work;
update cars set cars.pizhong = (select deadweight from truckimf where cars.chepai = truckimf.id)
where exists(select * from truckimf where cars.chepai = truckimf.id);
update cars set cars.pizhong = (select top 1 deadweight from truckimf where cars.chepai = truckimf.drivername)
where exists(select * from truckimf where cars.chepai = truckimf.drivername);
select count(*) from truckimf,cars where cars.chepai = truckimf.drivername group by drivername;
select cars.chepai,cars.pizhong,truckimf.deadweight,truckimf.id from cars,truckimf where cars.chepai = truckimf.id;
/*消除重复键*/
1、建立一张临时的车辆皮表
CREATE TABLE [TRUCKIMF2] (
[ID] [varchar] (30) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[DriverName] [varchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
[deadweight] [decimal](10, 2) NULL ,
[unit] [varchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
[mode] [varchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
[innerid] [varchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
[b_send] [bit] NULL
) ON [PRIMARY]
GO
2、建立索引,忽略重复键
3、插入数据
insert into truckImf2(id,deadweight,unit)
select id,deadweight,unit from truckImf where len(id) > 3;
insert into truckImf2(id,deadweight,unit)
select drivername,deadweight,unit from truckImf where len(id) < 4;
4、更新cars表的数据
update cars set cars.pizhong = (select deadweight from truckimf2 where cars.chepai = truckimf2.id)
where exists(select * from truckimf2 where cars.chepai = truckimf2.id);
update cars set cars.chedui = (select unit from truckimf2 where cars.chepai = truckimf2.id)
where exists(select * from truckimf2 where cars.chepai = truckimf2.id);
alter table cars add chedui varchar(20) null;
update cars set chedui = '销售' where leixing = 0;
- 导入表信息
- dbms_stats 导入导出表统计信息
- dbms_stats 导入导出 表级别 统计信息
- 转载】dbms_stats 导入导出表统计信息
- Excel信息导入
- 供应商信息导入
- 数据库运用_用EXCEL表导入心理咨询新生信息
- pyhon 脚本实现批量日志信息导入外部表分区
- 一张表的统计信息的导入导出-测试
- xml数据导入信息表批量导入sql sever 表InfoContent
- 客户信息导入(改写程序)
- 客户信息导入参考程序
- 信息和图片附件导入导出
- 跨进程 APIHOOK 非PE信息查询版本(没有遍历PE中的DLL导入表)
- 利用POI将数据库表结构信息导入excel模板中
- Oracle 统计信息(备份/导入)表分析-[注意要刷缓存]
- Flask学习-设备管理系统3:从excel表导入设备信息
- Oracle数据库表信息,序列,视图等导出,导入。(数据库备份和恢复)
- MyEclipse6.0集成SVN及配置详解
- 软件行业7条工作经验
- 在php中输出xml
- 解决在Fedora 12 中配置后Samba服务后,Windows依然无法访问Linux共享目录的问题。
- MTK开发中一些经验总结
- 导入表信息
- AIX和Linux下如何查看CPU和内存信息
- weblogic 生产环境*.jar 部署后程序class的路径
- 实体身份entity identity
- DataGrid自动排序
- 判断字符串的字节是否超过自定义的字节
- iis日志分析
- Flash与数学:球体曲面 (2)
- 两个小问题