首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

一日期格式字符串增加时间有关问题

2012-09-19 
一日期格式字符串增加时间问题?SQL codecreate table MOVIE_PLAYHIS_INFO(MOVIE_PLAYHIS_ID INT IDENTITY(

一日期格式字符串增加时间问题?

SQL code
create table MOVIE_PLAYHIS_INFO(  MOVIE_PLAYHIS_ID INT IDENTITY(1,2) not null,  START_TIME       VARCHAR(255),  END_TIME         VARCHAR(255),  primary key (MOVIE_PLAYHIS_ID));START_TIME 格式 ‘yyyy-mm-dd hh:mi:ss’24小时制增加2分两秒 怎么写SQL'2012-08-14 13:00:00'   更新为 '2012-08-14 13:02:02'


[解决办法]
SQL code
create table MOVIE_PLAYHIS_INFO(  MOVIE_PLAYHIS_ID INT IDENTITY(1,2) not null,  START_TIME       VARCHAR(255),  END_TIME         VARCHAR(255),  primary key (MOVIE_PLAYHIS_ID));insert into MOVIE_PLAYHIS_INFO(START_TIME) select '2012-08-14 13:00:00'select * from MOVIE_PLAYHIS_INFO/*MOVIE_PLAYHIS_ID START_TIME                     END_TIME---------------- ------------------------------ ------------------------------1                2012-08-14 13:00:00            NULL*/update MOVIE_PLAYHIS_INFO set START_TIME=convert(varchar(20),dateadd(s,2,cast(START_TIME as datetime)),120)select * from MOVIE_PLAYHIS_INFO/*MOVIE_PLAYHIS_ID START_TIME                     END_TIME---------------- ------------------------------ ------------------------------1                2012-08-14 13:00:02            NULL*/ 

热点排行