access与SqlServer 时间日期比较

WBOY
发布: 2016-06-07 15:45:34
原创
1525 人浏览过

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 tabl

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

access与SqlServer 时间日期比较

来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板