Comparison of common Oracle databases with Access and SQL Server Applications

Source: Internet
Author: User

The following articles mainly introduce the comparison between Oracle databases and Access, SQL Server, and common applications. I made a product in a company, access, SQL Server, and Oracle databases are required. Some general statements should be used during SQL statement writing, but some differences may not be avoided, here is a brief summary.

The following A Indicates Access, S indicates SQL Server, and O indicates Oracle.

1. Obtain the current system time

A: Select Now ()

S: Select Getdate ()

O: Select Sysdate From Dual

2. connection string

A :&

S: +

O: |

3. String functions (intercepting strings, uppercase letters, lowercase letters, and searching string locations)

A: Mid, UCase, LCase, InStr

S: SubString, Upper, Lower, CharIndex

O: SubStr, Upper, Lower, InStr

4. Judgment value statement

A: IIF

S: Case When Then

O: Decode

5. Time Field

A: Use the # separator or convert it to A date.

SELECT * FROM Books WHERE RegDate = #2007-5-1 # Or

SELECT * FROM Books WHERE RegDate = CDate ('2017-5-1 ′)

S: You can use ''directly''

 
 
  1. SELECT * FROM Books WHERE RegDate = ‘2007-5-1′  
  2. O:To_Date  
  3. SELECT * FROM Books WHERE RegDate=To_Date('2007-05-01','yyyy-mm-dd')  

6. Data Type Conversion

A: CStr, CInt, CDate

S: Convert

O: To_Char, To_Number, To_Date

7. Inser ..... Select... From Statement

 
 
  1. Insert Into a(ii,jj,kk) (Select ii,jj,kk From b) 

Such a statement does not have errors in SQL Server and Oracle databases, but the syntax error of the INSERT INTO statement is reported in Access. Access should remove the brackets of the Select statement, as shown below:

 
 
  1. Insert Into a(ii,jj,kk) Select ii,jj,kk From b 

At the same time, there will be no errors written in SQL Server and Oracle.

8. Keywords

Some letters are keywords in Access and SQL Server, which need to be defined by [] to solve the problem, for example: at, name

9. Alias

When fields in SQL Server and Oracle start aliases, as can be omitted, and Access cannot

10. Table name prefix

 
 
  1. Select *,1 From A 

Such statements are not wrong in Access and SQL Server, but cannot be used in Oracle databases. They must be written as follows:

 
 
  1. Select A.*,1 From A 

11. If the statement contains: (colon), for example, a query with a time field: CalcDate = #11:00:00 #, the following error occurs in Access: the parameter object is incorrectly defined. Provide inconsistent or incomplete information. Set the ParamCheck of the corresponding Query to False.

12. The logical values in Access are-1 and 0 in the database, while those in SQL Server are 1 and 0. Therefore, there is a compatibility problem when writing statements such as BoolField = 1. Change them to BoolField <> 0.

13. The varchar text type of Access has a maximum value of 255. Therefore, if a text field is greater than 255, it is best to define it as remarks type Access) or text type SQL Server );

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.