MSSQL语句更新当前数据表中时间日期

update Member set M_GetStatic_Time=(select dateadd(day,7,(select M_GetStatic_Time from Member where M_ID=1)) as NewTime) where M_ID=1

1. 一个日期加一天,或者加一个月declare @date datetimeset @date = '2008-01-04'select @date + 1select dateadd(day,1,@date)select dateadd(month,1,@date)

select getdate()--获取完整日期 具体到毫秒         2012-02-15 11:41:24.903

select convert(varchar,getdate(),120) --具体到秒  2012-02-15 11:46:04

select convert(varchar,getdate(),121)             2012-02-15 11:46:43.810

select convert(nvarchar,getdate(),20)             2012-02-15 11:45:42

select convert(nvarchar,getdate(),21)             2012-02-15 11:47:37.340

select convert(nvarchar,getdate(),22)             02/15/12 11:48:01 AM

select convert(nvarchar,getdate(),23)             2012-02-15

select convert(nvarchar,getdate(),24)             11:48:42

select convert(nvarchar,getdate(),25)             2012-02-15 11:49:00.030

select convert(nvarchar,getdate(),100)            02 15 2012 11:51AM

select convert(nvarchar,getdate(),101)            02/15/2012

select convert(nvarchar,getdate(),102)            2012.02.15

select convert(nvarchar,getdate(),103)            15/02/2012

select convert(nvarchar,getdate(),104)            15.02.2012

select convert(nvarchar,getdate(),105)            15-02-2012

select convert(nvarchar,getdate(),106)            15 02 2012

select convert(nvarchar,getdate(),107)            02 15, 2012

select convert(varchar(10),getdate(),108) --时间  11:47:15

select convert(nvarchar,getdate(),109)            02 15 2012 11:54:16:250AM

select convert(nvarchar,getdate(),110)            02-15-2012

select convert(nvarchar,getdate(),111)            2012/02/15

select convert(nvarchar,getdate(),112)            20120215

select convert(nvarchar,getdate(),113)            15 02 2012 11:55:18:293

select convert(nvarchar,getdate(),114)            11:55:32:373

posted @ 2022-10-28 16:54  Rukh  阅读(691)  评论(0编辑  收藏  举报