Collection Contents 上一页 下一页 PDF

ASA SQL 用户指南

Transact-SQL 兼容性

Transact-SQL 支持概述


Adaptive Server Anywhere 支持 Transact-SQL 中相当大的一部分,Transact-SQL 是 Sybase Adaptive Server Enterprise 所支持的 SQL 方言。本章将介绍 Adaptive Server Anywhere 和 Adaptive Server Enterprise 之间的 SQL 兼容性。

目标 

Adaptive Server Anywhere 对 Transact-SQL 的支持可以达到以下目的:

主要的目标是编写既可用于 Adaptive Server Enterprise 又可用于 Adaptive Server Anywhere 的应用程序。现有的 Adaptive Server Enterprise 应用程序通常需要做出一些更改才能在 Adaptive Server Anywhere 数据库上运行。

怎样才能支持 Transact-SQL 

Adaptive Server Anywhere 通过以下形式支持 Transact-SQL:

下图说明了这两种方言的重叠情况。

A Venn diagram of two circles. The non-overlapping parts of the two circles show statements such as CREATE PROCEDURE and CREATE TRIGGER that have distinct syntaxes in Adaptive Server Anywhere and Transact-SQL. The overlapping area shows statements that are the same in both servers, such as SELECT, INSERT, UPDATE and DELETE.
相似之处和差异 

在处理现有数据时,Adaptive Server Anywhere 支持大多数的 Transact-SQL 语言元素、函数和语句。例如,Adaptive Server Anywhere 支持所有数字函数、所有字符串函数(一种函数除外)、所有集合函数以及所有日期和时间函数。又比如,Adaptive Server Anywhere 支持 Transact-SQL 外部连接(使用 =* 和 *= 运算符),还支持使用连接的 DELETE 和 UPDATE 扩展语句。

另外,Adaptive Server Anywhere 还支持大多数的 Transact-SQL 存储过程语言(CREATE PROCEDURE 和 CREATE TRIGGER 语法、控制语句等)以及 Transact-SQL 数据定义语言语句的许多(但不是所有)方面。

每种产品所支持的体系结构和配置功能存在着设计上的差异。设备管理、用户管理和维护任务(如备份)往往是因系统而异的。即使在这种情况下,Adaptive Server Anywhere 仍将 Transact-SQL 系统表作为视图来提供(在视图中,在 Adaptive Server Anywhere 中没有任何意义的表将不显示任何行)。此外,Adaptive Server Anywhere 为某些常见的管理任务提供了一组系统过程。

在讨论这些方言的数据操作和数据定义语言等兼容性高的方面之前,本章将首先讨论一些差异最为明显的系统层面上的问题。

仅限 Transact-SQL 

Adaptive Server Anywhere 所支持的某些 SQL 语句只在一种方言中使用,而不在另一种方言中使用。您不能在一个过程、触发器或批处理语句中混用两种方言。例如,Adaptive Server Anywhere 支持以下语句,但这些语句仅用于 Transact-SQL 方言:

仅限 Adaptive Server Anywhere 

Adaptive Server Enterprise 不支持以下语句:

注意 

不能在一个过程、触发器或批处理语句中混用两种方言。这意味着:


Collection Contents 上一页 下一页 PDF