加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

【Sqlserver】修改数据库表中的数据:对缺失的数据根据已有的数

发布时间:2020-12-12 13:07:42 所属栏目:MsSql教程 来源:网络整理
导读:1 -- 查询时间范围内的数据 2 select * from dbo.point where wtime ' 2014-05-01 23:59:59 ' and wtime ' 2014-05-02 00:40:42.000 ' 3 4 5 delete from point where wtime ' 2014-05-01 23:59:59 ' and wtime ' 2014-05-02 00:40:42.000 ' 6 7 -- 查询时间

1
--查询时间范围内的数据 2 select * from dbo.point where wtime >'2014-05-01 23:59:59' and wtime< '2014-05-02 00:40:42.000' 3 4 5 delete from point where wtime >'2014-05-01 23:59:59' and wtime< '2014-05-02 00:40:42.000' 6 7 --查询时间范围内的数据,并插入到临时表中 8 select * into a_temp from point where wtime between '2014-05-01 00:00:42.000' and '2014-05-01 00:40:42.000' 9 10 --查询临时表内的数据 11 select * from a_temp 12 13 14 --更新临时表的时间 15 update a_temp set wtime=DATEADD(day,1,wtime) 16 17 --把临时表中的数据插入到表中 18 insert into point select pointid,pointtype,pointvalue,pointunit,pointvalue2,pointunit2,wtime from a_temp

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读