Comparison of functions between VBA and T-SQL; how are SQL statements of SQL server used in access? (From http://access911.net)

Source: Internet
Author: User
Tags mathematical functions rtrim

Comparison of functions between Visual Basic for Applications and SQL Server Transact-SQL (ADP)
Note that the information in this topic applies only to the Microsoft Access Project (. ADP ).

The following table compares common functions in Microsoft Visual Basic for Applications (VBA) and Microsoft SQL Server Transact-SQL. For more information about Transact-SQL scalar functions, see the SQL server documentation.

Note that the "Promotion wizard" converts the following VBA functions (used for table validity rules, field verification, and default) to equivalent Transact-SQL functions.

 

String Functions

VBA functions: Transact-SQL
Scalar functions
------------------------------------------------
ASC (x) ASCII (X)
CHR $ (x) Char (X)
Lcase $ (x) lcase (X)
Lower (X)
Len (x) datalength (X)
Ltrim $ (x) ltrim (X)
Mid $ (x, y, z) substring (x, y, z)
Right $ (x, y) Right (x, y)
Rtrim $ (x) rtrim (X)
Space $ (x) Space (X)
STR $ (x) STR (X)
Ucase $ (x) ucase (X)
Upper (X)

 

Conversion functions

VBA functions: Transact-SQL
Scalar functions
------------------------------------------------
Ccur (x) convert (money, X)
Cdbl (x) convert (float, X)
CINT (x) convert (smallint, X)
Clng (x) convert (INT, X)
Csng (x) convert (Real, X)
CSTR (x) convert (varchar, X)
Cvdate (x) convert (datetime, X)

 

 

Date Functions

VBA functions: Transact-SQL
Scalar functions
------------------------------------------------
Date (x) convert (datetime, convert (varchar, getdate (X )))
Dateadd ("<access datepart>", x, y) dateadd (<SQL Server datepart>, x, y)
Datediff ("<access datepart>", x, y) datediff (<SQL Server datepart>, x, y)
Datepart ("<access datepart>", x) datepart (<SQL Server datepart>, X)
Day (x) datepart (DD, X)
Hour (x) datepart (HH, X)
Minute (x) datepart (MI, X)
Month (x) datepart (mm, X)
Now (x) getdate (X)
Second (x) datepart (SS, X)
Weekday (x) datepart (DW, X)
Year (x) datepart (YY, X)

 

 

mathematical functions
VBA functions: Transact-SQL
scalar functions
--------------------------------------------
int (x) floor (x)
SGN (X) sign (x)
RND (x) round (x)


other functions sorted by access911
VBA function: Transact-SQL
scalar function
--------------------------------------------
replace Replace
mid substring
NZ isnull

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.