文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>SQL2000 Access 时间日期比较

SQL2000 Access 时间日期比较

时间:2010-08-28  来源:血吸虫

SQL2000 Access 时间日期比较

引自:http://hi.baidu.com/iojessie/blog/item/1c78b3efc0456833adafd543.html

access与SqlServer 之时间与日期及其它SQL语句比较

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

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载