sql SERVER 2000用sql语句如何获得当前系统时间
就是用GETDATE();
sql中的getDate()
sql;">
Select CONVERT(varchar(100),GETDATE(),0): 05 16 2008 10:57AM
Select CONVERT(varchar(100),1): 05/16/08
Select CONVERT(varchar(100),2): 08.05.16
Select CONVERT(varchar(100),3): 16/05/08
Select CONVERT(varchar(100),4): 16.05.08
Select CONVERT(varchar(100),5): 16-05-08
Select CONVERT(varchar(100),6): 16 05 08
Select CONVERT(varchar(100),7): 05 16,08
Select CONVERT(varchar(100),8): 10:57:46
Select CONVERT(varchar(100),9): 05 16 2008 10:57:46:827AM
Select CONVERT(varchar(100),10): 05-16-08
Select CONVERT(varchar(100),11): 08/05/16
Select CONVERT(varchar(100),12): 080516
Select CONVERT(varchar(100),13): 16 05 2008 10:57:46:937
Select CONVERT(varchar(100),14): 10:57:46:967
Select CONVERT(varchar(100),20): 2008-05-16 10:57:47
Select CONVERT(varchar(100),21): 2008-05-16 10:57:47.157
Select CONVERT(varchar(100),22): 05/16/08 10:57:47 AM
Select CONVERT(varchar(100),23): 2008-05-16
Select CONVERT(varchar(100),24): 10:57:47
Select CONVERT(varchar(100),25): 2008-05-16 10:57:47.250
Select CONVERT(varchar(100),100): 05 16 2008 10:57AM
Select CONVERT(varchar(100),101): 05/16/2008
Select CONVERT(varchar(100),102): 2008.05.16
Select CONVERT(varchar(100),103): 16/05/2008
Select CONVERT(varchar(100),104): 16.05.2008
Select CONVERT(varchar(100),105): 16-05-2008
Select CONVERT(varchar(100),106): 16 05 2008
Select CONVERT(varchar(100),107): 05 16,2008
Select CONVERT(varchar(100),108): 10:57:49
Select CONVERT(varchar(100),109): 05 16 2008
10:57:49:437AM
Select CONVERT(varchar(100),110): 05-16-2008
Select CONVERT(varchar(100),111): 2008/05/16
Select CONVERT(varchar(100),112): 20080516
Select CONVERT(varchar(100),113): 16 05 2008 10:57:49:513
Select CONVERT(varchar(100),114): 10:57:49:547
Select CONVERT(varchar(100),120): 2008-05-16 10:57:49
Select CONVERT(varchar(100),121): 2008-05-16 10:57:49.700
Select CONVERT(varchar(100),126): 2008-05-16T10:57:49.827
Select CONVERT(varchar(100),130): 18 ???? ?????? 1427
10:57:49:907AM
Select CONVERT(varchar(100),131): 18/04/1427
10:57:49:920AM
获取sql Server服务器时间
insert into tablename (Date) value getDate()
"select getdate() as serverDate"
然后读取serverDate属性即为sql Server服务器时间。
也可用下面语句直接获取:
select getdate()
select CURRENT_TIMESTAMP
得到时间如下格式:
2016-07-07 14:07:15.670