Access、SQLServer、Oracle常见SQL语句应用区别
Access、SQLServer、Oracle 常见 SQL 语句 应用 区别 关劲松 PMP 如果要兼容Access、SQL Server、Oracle三个数据库版本;我们在编写SQL 语句 的过程中,尽量使用一些通用的 语句 ,但还是有些方面有些 区别 避免不了,现简单总结一下。 以下A代表Access,S代
Access、SQLServer、Oracle常见SQL语句应用区别
关劲松 PMP
如果要兼容Access、SQL Server、Oracle三个数据库版本;我们在编写SQL语句的过程中,尽量使用一些通用的语句,但还是有些方面有些区别避免不了,现简单总结一下。
以下A代表Access,S代表SQL Server,O代表Oracle
1、取当前系统时间
A:Select Now()
S:Select Getdate()
O:Select Sysdate From Dual
2、连接字符串
A:&
S:+
O:||
3、字符串函数(截取字符串、大写、小写、查找字符串位置)
A:Mid、UCase、LCase、InStr
S:SubString、Upper、Lower、CharIndex
O:SubStr、Upper、Lower、InStr
4、判断取值语句
A:IIF
S:Case When Then
O:Decode
5、时间字段
A:要用#号分隔,或者转换为日期
SELECT * FROM Books WHERE RegDate = #2007-5-1# 或
SELECT * FROM Books WHERE RegDate = CDate(’2007-5-1′)
S:可以直接用''
SELECT * FROM Books WHERE RegDate = ‘2007-5-1′
O:To_Date
SELECT * FROM Books WHERE RegDate=To_Date('2007-05-01','yyyy-mm-dd')
6、数据类型转换
A:CStr,CInt,CDate
S:Convert,CAST
O:To_Char,To_Number,To_Date
7、Inser Into …..Select …From 语句
Insert Into a(ii,jj,kk) (Select ii,jj,kk From b)
这样的语句,在SQL Server以及Oracle中都不会有错,但在Access中会报:INSERT INTO 语句的语法错误。Access应该把后面Select语句的括号去掉,如下:
Insert Into a(ii,jj,kk) Select ii,jj,kk From b
同时这样写在SQL Server和Oracle中都不会有错
8、关键字
有些字母在Access,SQL Server中是关键字,需要用[ ]界定可解决问题,例如:at,name
9、别名
SQL Server和Oracle中字段起别名时as可以省略,Access不能
10、表名前缀
Select *,1 From A
这样的语句在Access,SQL Server中不会有错,但在Oracle中是不行的,必须要写成这样:
Select A.*,1 From A
11、如果语句中有:(冒号),例如有时间字段的查询:CalcDate=#2008-05-01 11:00:00#,在Access中一般会出现如下错误:不正常地定义参数对象。提供了不一致或不完整的信息。将相应
Query的ParamCheck 设为False即可。
12、Access中的逻辑值在库中为-1和0,而SQL Server中为1和0,所以写BoolField = 1这样的语句有兼容性问题,应该改为BoolField 0
13、Access的varchar(文本)型最大只有255,所以如果一个文本型字段大于255时,最好定义成备注型(Access中)或text型(SQL Server中)。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to configure Zend in Apache? The steps to configure Zend Framework in an Apache Web Server are as follows: Install Zend Framework and extract it into the Web Server directory. Create a .htaccess file. Create the Zend application directory and add the index.php file. Configure the Zend application (application.ini). Restart the Apache Web server.

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

Apache server is a powerful web server software that acts as a bridge between browsers and website servers. 1. It handles HTTP requests and returns web page content based on requests; 2. Modular design allows extended functions, such as support for SSL encryption and dynamic web pages; 3. Configuration files (such as virtual host configurations) need to be carefully set to avoid security vulnerabilities, and optimize performance parameters, such as thread count and timeout time, in order to build high-performance and secure web applications.

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

VprocesserazrabotkiveB-enclosed, Мнепришлостольностьсясзадачейтерациигооглапидляпапакробоглесхетсigootrive. LEAVALLYSUMBALLANCEFRIABLANCEFAUMDOPTOMATIFICATION, ČtookazaLovnetakProsto, Kakaožidal.Posenesko

Nginx performance monitoring and troubleshooting are mainly carried out through the following steps: 1. Use nginx-V to view version information, and enable the stub_status module to monitor the number of active connections, requests and cache hit rate; 2. Use top command to monitor system resource occupation, iostat and vmstat monitor disk I/O and memory usage respectively; 3. Use tcpdump to capture packets to analyze network traffic and troubleshoot network connection problems; 4. Properly configure the number of worker processes to avoid insufficient concurrent processing capabilities or excessive process context switching overhead; 5. Correctly configure Nginx cache to avoid improper cache size settings; 6. By analyzing Nginx logs, such as using awk and grep commands or ELK

Configuring WebLogic database connection on a CentOS system requires the following steps: JDK installation and environment configuration: Make sure that the server has installed a JDK that is compatible with the WebLogic version (for example, WebLogic14.1.1 usually requires JDK8). Correctly set JAVA_HOME, CLASSPATH and PATH environment variables. WebLogic installation and decompression: Download the WebLogic installation package for CentOS system from the official Oracle website and unzip it to the specified directory. WebLogic user and directory creation: Create a dedicated WebLogic user account and set a security password

The Nginx current limit problem can be solved by: use ngx_http_limit_req_module to limit the number of requests; use ngx_http_limit_conn_module to limit the number of connections; use third-party modules (ngx_http_limit_connections_module, ngx_http_limit_rate_module, ngx_http_access_module) to implement more current limit policies; use cloud services (Cloudflare, Google Cloud Rate Limiting, AWS WAF) to DD
