首页 > 数据库技术 > 详细

SQL修改日期时间型数据中的年月日

时间:2014-11-20 13:27:35      阅读:465      评论:0      收藏:0      [点我收藏+]

以下语句为更改 tevent表中的eventtime字段为2011-7-16当eventtime为2012-02-29时

update tevent set  eventtime=‘2011-7-16‘+right(convert(varchar(23),eventtime,121),13)    where convert(varchar(10),eventtime,121)=‘2012-02-29 ‘

以下语句为根据eventid字段的值来更改eventtime的值为‘2011-01-01‘

update tevent set  eventtime=‘2011-01-01‘+right(convert(varchar(23),eventtime,121),13)    where eventid  >=11 and eventid  <= 20

SQL修改日期时间型数据中的年月日

原文:http://www.cnblogs.com/cuihongyu3503319/p/4110288.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!