
怎么用sql语句 update date型数据?
Updatescott.empSethiredate='1980-12-13';Updatescott.empSethiredate=1980-12-13;都不可以。。...
Update scott.emp Set hiredate ='1980-12-13';
Update scott.emp Set hiredate =1980-12-13 ;
都不可以。。 展开
Update scott.emp Set hiredate =1980-12-13 ;
都不可以。。 展开
展开全部
oracle吧:
Update scott.emp Set hiredate =to_date('1980-12-13','yyyy-mm-dd');
要是sqlserver的话,
Update scott.emp Set hiredate ='1980-12-13';
就可以
Update scott.emp Set hiredate =to_date('1980-12-13','yyyy-mm-dd');
要是sqlserver的话,
Update scott.emp Set hiredate ='1980-12-13';
就可以
展开全部
你当前用户有对scott用户下对象修改的权限吗?
如果有的话
Update scott.emp Set hiredate =to_date('1980-12-13','yyyy-mm-dd');
这个语句就是可以的
如果有的话
Update scott.emp Set hiredate =to_date('1980-12-13','yyyy-mm-dd');
这个语句就是可以的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
第2句这样用不正确,虽然不出错,结果不正确
Update scott.emp Set hiredate =1980-12-13 ;
--等同于
Update scott.emp Set hiredate =1955 ;
--计算方式
SELECT CAST(1955 AS DATETIME)--1905-05-10
计算方法1900-01-01日期加上1955天
Update scott.emp Set hiredate =1980-12-13 ;
--等同于
Update scott.emp Set hiredate =1955 ;
--计算方式
SELECT CAST(1955 AS DATETIME)--1905-05-10
计算方法1900-01-01日期加上1955天
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
例子:Select CONVERT(varchar(100), GETDATE(), 23)
显示:2012-07-19
Update scott.emp Set hiredate=CONVERT(varchar,'2012-07-19',23)
照这个例子套一下,就可以了
显示:2012-07-19
Update scott.emp Set hiredate=CONVERT(varchar,'2012-07-19',23)
照这个例子套一下,就可以了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
如果是oracle 是有to_date函数的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询