Appendix B: Expression Translation Table

When you add defaults to SQL Server with the SQL Server Browser, the SQL Server Browser converts most common Microsoft Access expressions to SQL Server expressions. The following expressions are converted:

Microsoft Access functions SQL Server functions
String functions
chr$(x) char(x)
asc(x) ascii(x)
str$(x) str(x)
space$( x) space(x)
lcase$(x) lower(x)
ucase$( x) upper(x)
len(x) datalength(x)
ltrim$( x) ltrim(x)
rtrim$(x) rtrim(x)
right$(x,y) right(x,y)
mid$(x,y,z) substring(x,y,z)
Conversion functions
cint(x) convert(smallint,x)
clng(x) convert(int,x)
csng(x) convert(real,x)
cdbl(x) convert(float,x)
cstr(x) convert(varchar,x)
ccur(x) convert(money,x)
cvdate(x) convert(datetime,x)

Microsoft Access functions SQL Server functions
Date functions
now(x) getdate(x)
date(x ) convert(datetime,convert(varchar,getdate(x)))
year(x) datepart(yy,x)
month(x) datepart(mm,x)
day(x) datepart(dd,x)
weekday(x) datepart(dw,x)
hour(x) datepart(hh,x)
minute(x) datepart(mi,x)
second(x) datepart(ss,x)
datepart("<Access datepart>", x) datepart(<SQL Server datepart>, x)
dateadd("<Access datepart>", x, y) dateadd(<SQL Server datepart>, x, y)
datediff("<Access datepart>", x, y) datediff(<SQL Server datepart>, x, y)
Math functions
int(x) floor(x)
sgn(x) sign(x)

The Upsizing Wizard and the SQL Server Browser replace a number of delimiters, operators, constants, and wildcard characters, as listed in the following table.

 

Description Microsoft Access SQL Server
Date delimiter # '
String delimiter " '
Mod operator mod %
Concatenation operator & +
Wildcard character ? _
Wildcard character * %
Constant Yes 1
Constant On 1
Constant True 1
Constant No 0
Constant Off 0
Constant False 0