程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> SqlServer數據庫 >> 關於SqlServer >> access與SqlServer 之時間與日期及其它SQL語句比較

access與SqlServer 之時間與日期及其它SQL語句比較

編輯:關於SqlServer
1、Datediff:1.1算出日期差:
1.Access: datediff('d',fixdate,getdate())
2.sqlserver: datediff(day,fixdate,getdate())
Access實例: select * from table where data=datediff('d',fixdate,getdate())
sqlserver實例: select * from table where data=datediff(day,fixdate,getdate())1.2算出時間差:
1.Access: datediff('h',fixdate,getdate())
2.sqlserver: datediff(Hour,'2004-12-10',getdate())
Access實例: select DATEDIFF('h',HMD,getdate())
sqlserver實例: select datediff(Hour,'2004-12-10',getdate())1.3算出月份差:
1.Access: datediff('m',fixdate,getdate())
2.sqlserver: datediff(Month,'2004-12-10',getdate())
Access實例: select DATEDIFF('m',HMD,getdate())
sqlserver實例: select datediff(Month,'2004-12-10',getdate())
----------------------------------------------------------------------------2、日期變量
1.Access: #"&data&"#
2.sqlserver: '"&data&"'
Access實例: select * from table where data=#"&data&"#
sqlserver實例: select * from table where data='"&data&"'
----------------------------------------------------------------------------3、是否
1.Access: not finished
2.sqlserver: finished=0
Access實例: select * from table where not finished
sqlserver實例: select * from table where finished=0
----------------------------------------------------------------------------4、求余數1.Access: a mod b=100
2.sqlserver: a % b =100
Access實例: select a mod b=100 from table where not finished
sqlserver實例: select a % b =100 from table where finished=0
----------------------------------------------------------------------------5、獲取當天日期
1.Access: now()
2.sqlserver: getdate()
Access實例: select now()
sqlserver實例: select getdate() -
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved