background image

    Access 中:True、False;On、Off;Yes、No;整数:-1(真)、0(假)。
6、字符串连接 
    SqlServer 中:加号(+)
    Access 中:和号(&)
7、通配符
    SqlServer 中:
     百分号(%)与零个或更多字符匹配。  
     下划线(_)与单个字符匹配。 
     上插入符(^)意味着不在列表中。 
     没有与英镑符(#)对应的字符。
   Access 中:   星号(*)与零个或更多字符匹配。  
           问号(?)与单个字符匹配。 
           叹号(!)意味着不在列表中。 
           英镑符(#)意味着单个数字。 
8、

Drop

 

Index

    SqlServer 中:

Drop

 

Index

 <表名>.<索引名> 

    Access 中: 

Drop

 

Index

 <索引名> ON <表名> 

9.表添加标识列

 

  

Access: 

alter

 

table

 

<

表名

>

 

add

 

列名

 Counter

(

1

,

1

);

  

SqlServer

alter

 

table

 

<

表名

>

 

add

 

列名

 

bigint

 

identity

(

1

,

1

)

 

not

 

null;

10.系统时间及常用时间函数

SqlServer:

   

select

 

getdate

()

Access:

    

select

 

date

()+

time

()    

Select

 Now

()

SqlServer

 中获取日期时间函数是

convert

(

datetime

,

getdate

(),

0

)

 

    而在 Access 中为

date

()+

time

() 

或者 Now()

Access

中,

datediff

 ()和

dateadd

 ()函数表示时间类型的部分必须用单引号括起来

select

 

datediff

(

'n'

,

addtime

,

now

())

 

from 

表名

;

select

 

dateadd

(

'd'

,

5

,

now

())

;

而在SqlServer中,必须写成

select

 

datediff

(

n

,

addtime

,

getdate

())

 

from 

表名

;

select

 

dateadd

(

d

,

5

,

getdate

());

11. Access

不支持

between

语句和

 

Case

+

When

+

Else

 语句

12.字符串函数(截取字符串、大写、小写、查找字符串位置)

   Access:   

Mid

UCase

LCase

InStr

         

select

 

Mid

(

列名,

2

,

4

)

 

from 

<

表名>;

        

select

 

UCase

(

列名)

 

from

  <

表名>

;

        

select

 

LCase

(

列名)

 

from

  <

表名>

;

        

select

 

InStr

(

列名

,

 'abc'

)

 

from

  <

表名>

;//

查找字符串位置

   SqlServer: 

SubString

Upper

Lower

CharIndex

         

select

 

substring

(

列名,

2

,

4

)

 

from 

<

表名>;

        

select

 

Upper

(

列名)

 

from 

<

表名>

;

        

select

 

Lower

(

列名)

 

from

  <

表名>

;

        

select

 

CharIndex

(

'abc'

列名)

 

from

  <

表名>

;//

查找字符串位置

        

select

 

CharIndex

(

'abc'

列名

,2

)

 

from

  <

表名>

;//

查找字符串位置