关于update语句(大侠们帮帮忙!急)
数据库里有一个表
rq
2007-08-25 19:56:00
2007-08-25 20:21:00
2007-08-25 21:34:00
如何把2007-08-25 改成 2007-08-24 后面不变
------解决方案-------------------- create table #t
(
date1 datetime
)
insert into #t
select '2007-08-25 19:56:00 ' union all
select '2007-08-25 20:21:00 ' union all
select '2007-08-25 21:34:00 '
update #t
set date1=dateadd(day,-1,date1)
where convert(varchar(10),date1,120)= '2007-08-25 '
select * from #t
date1
------------------------------------------------------
2007-08-24 19:56:00.000
2007-08-24 20:21:00.000
2007-08-24 21:34:00.000
(3 row(s) affected)