
select modify_date from sys.tables where name='表名'
如果你想实现这个功能,添加个备查表后,添加个触发器.将插入日期更新到触发器,以后在查询就可以查询了.
不同的数据库产品有不同的方式。Oracle中设置一个参数就好了
set timing on;
mysql能在里面直接看到了。
SQLServer中
declare @time datetime
set @time=getdate()
--这里是查询语句 如:
select count(*) from tb
--下面就是时间差:单位毫秒
select datediff(ms,@time,getdate())
SQL数据库记录修改时间如果要改成 当天日期的话:
update 表名 set checktime=to_date(to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') where checktime=to_date('2010-10-11 19:14:43','yyyy-mm-dd hh24:mi:ss')
----如果要这样改的话:2010-10-11 19:14:43 改成 2011-11-11 19:14:43 。就是只改月数的话,
----可以用add_months(date,n)函数
update 表名 set checktime= add_months(checktime,12) where checktime=to_date('2010-10-11 19:14:43','yyyy-mm-dd hh24:mi:ss')
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)