--时间计算: select GETDATE() select dateadd(year,-1,GETDATE()) select dateadd(month,-1,GETDATE()) select dateadd(day,-1,GETDATE()) select dateadd(HOUR,-1,GETDATE()) select dateadd(MINUTE,-1,GETDATE()) select dateadd(SECOND,-1,GETDATE()) --查询结果自带序号: select Row_Number() over (order by getdate()) as num,* from t_user