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()
-