The Adaptive Server Reference Manual is a guide to Sybase® Adaptive Server™ Enterprise and the Transact-SQL® language. This book describes the “building blocks” of Transact-SQL, which are datatypes, built-in functions, expressions and identifiers, SQLSTATE errors, and reserved words. Before you can use Transact-SQL successfully, you need to understand the function of each of these building blocks and how its use affects the results of Transact-SQL statements.
This book provides reference information about the Transact-SQL commands, which you use to create statements. It also provides reference information about system procedures, catalog stored procedures, extended stored procedures, and dbcc stored procedures. All procedures are created using Transact-SQL statements.
Reference information is also provided for the system tables, which store information about your server, databases, users, and other elements of your server.
The Adaptive Server Reference Manual is intended as a reference tool for Transact-SQL users of all levels.
This manual contains the following:
Chapter 1, “System and User-Defined Datatypes,” describes the system and user-defined datatypes that are supplied with Adaptive Server and indicates how to use them to create user-defined datatypes.
Chapter 2, “Transact-SQL Functions,” serves as an introduction to the Adaptive Server aggregate functions, datatype conversion functions, date functions, mathematical functions, row aggregate functions, string functions, system functions, and text and image functions.
Chapter 3, “Global Variables,” contains information about system-defined variables updated by Adaptive Server on an ongoing basis.
Chapter 4, “Expressions, Identifiers, and Wildcard Characters,” contains information about using the Transact-SQL language.
Chapter 5, “Reserved Words,” contains information about the Transact-SQL and SQL92 keywords.
Chapter 6, “SQLSTATE Codes and Messages,” contains information about Adaptive Server’s SQLSTATE status codes and the associated messages.
Chapter 7, “Commands,” serves as an introduction to every Transact-SQL command. Particularly complex commands, such as select, are divided into subsections. For example, there are reference pages on the compute clause and on the group by and having clauses of the select command.
Chapter 8, “System Procedures,” serves as an introduction to Adaptive Server system procedures.
Chapter 9, “Catalog Stored Procedures,” contains reference pages for Adaptive Server catalog stored procedures.
Chapter 10, “System Extended Stored Procedures,” contains reference pages for Adaptive Server system extended stored procedures.
Chapter 11, “dbcc Stored Procedures,” contains reference pages for Adaptive Server dbcc stored procedures.
Chapter 12, “System Tables,” contains information about all of the system tables in the master database, the auditing database, and in any user databases (such as pubs2).
Chapter 13, “dbccdb Tables,” contains information about the tables in the dbccdb and dbccalt databases.
The following documents comprise the Sybase Adaptive Server Enterprise documentation:
The release bulletin for your platform – contains last-minute information that was too late to be included in the books.
A more recent version of the release bulletin may be available on the Sybase Web site. To check for critical product or document information that was added after the release of the product CD, see the Technical Library.
The Adaptive Server installation documentation for your platform – describes installation, upgrade, and configuration procedures for all Adaptive Server and related Sybase products.
What’s New in Adaptive Server Enterprise? – describes the new features in Adaptive Server version 12, the system changes added to support those features, and the changes that may affect your existing applications.
Transact-SQL User’s Guide – documents Transact-SQL, Sybase’s enhanced version of the relational database language. This manual serves as a textbook for beginning users of the database management system. This manual also contains descriptions of the pubs2 and pubs3 sample databases.
System Administration Guide – provides in-depth information about administering servers and databases. This manual includes instructions and guidelines for managing physical resources, security, user and system databases, and specifying character conversion, international language, and sort order settings.
Adaptive Server Reference Manual – contains detailed information about all Transact-SQL commands, functions, procedures, and datatypes. This manual also contains a list of the Transact-SQL reserved words and definitions of system tables.
Performance and Tuning Guide – explains how to tune Adaptive Server for maximum performance. This manual includes information about database design issues that affect performance, query optimization, how to tune Adaptive Server for very large databases, disk and cache issues, and the effects of locking and cursors on performance.
The Utility Programs manual for your platform – documents the Adaptive Server utility programs, such as isql and bcp, which are executed at the operating system level.
Error Messages and Troubleshooting Guide – explains how to resolve frequently occurring error messages and describes solutions to system problems frequently encountered by users.
Component Integration Services User’s Guide – explains how to use the Adaptive Server Component Integration Services feature to connect remote Sybase and non-Sybase databases.
Java in Adaptive Server Enterprise – describes how to install and use Java classes as datatypes and user-defined functions in the Adaptive Server database.
Using Sybase Failover in a High Availability System – provides instructions for using Sybase’s Failover to configure an Adaptive Server as a companion server in a high availability system.
Using Adaptive Server Distributed Transaction Management Features – explains how to configure, use, and troubleshoot Adaptive Server DTM Features in distributed transaction processing environments.
XA Interface Integration Guide for CICS, Encina, and TUXEDO provides instructions for using Sybase’s DTM XA Interface with X/Open XA transaction managers.
Adaptive Server Glossary – defines technical terms used in the Adaptive Server documentation.
Use the Sybase Technical Library CD and the Technical Library Product Manuals web site to learn more about your product:
The Technical Library CD contains product manuals and is included with your software. The DynaText reader (included on the Technical Library CD) allows you to access technical information about your product in an easy-to-use format.
Refer to the Technical Library Installation Guide in your documentation package for instructions on installing and starting the Technical Library.
The Technical Library Product Manuals web site is an HTML version of the Technical Library CD that you can access using a standard web browser. In addition to product manuals, you will find links to EBFs/Updates, Technical Documents, Case Management, Solved Cases, newsgroups, and the Sybase Developer Network.
To access the Technical Library Product Manuals web site, go to Product Manuals.
Technical documentation at the Sybase web site is updated frequently.
Finding the latest information on product certifications
Point your web browser to Technical Documents.
Select Products from the navigation bar on the left.
Select a product name from the product list and click Go.
Select the Certification Report filter, specify a time frame, and click Go.
Click a Certification Report title to display the report.
Creating a personalized view of the Sybase web site (including support pages)
Set up a MySybase profile. MySybase is a free service that allows you to create a personalized view of Sybase web pages.
Point your web browser to Technical Documents.
Click MySybase and create a MySybase profile.
Finding the latest information on EBFs and software updates
Point your web browser to the Sybase Support Page.
Select EBFs/Updates. Enter user name and password information, if prompted (for existing web accounts) or create a new account (a free service).
Select a product.
Specify a time frame and click Go.
Click the Info icon to display the EBF/Update report, or click the product description to download the software.
The following sections describe conventions used in this manual.
SQL is a free-form language. There are no rules about the number of words you can put on a line or where you must break a line. However, for readability, all examples and most syntax statements in this manual are formatted so that each clause of a statement begins on a new line. Clauses that have more than one part extend to additional lines, which are indented. Complex commands are formatted using modified Backus Naur Form (BNF) notation.
Table 1 shows the conventions for syntax statements that appear in this manual:
Element |
Example |
---|---|
Command names, command options, utility names, utility options, and other keywords are bold. |
select sp_configure |
Database names, datatypes, file names and path names are in italics. |
master database |
Variables, or words that stand for values that you fill in, are in italics. |
select column_name from table_name where search_conditions
|
Type parentheses as part of the command. |
compute row_aggregate (column_name)
|
Double colon, equals sign indicates that the syntax is written in BNF notation. Do not type this symbol. Indicates “is defined as”. |
::= |
Curly braces mean that you must choose at least one of the enclosed options. Do not type the braces. |
{cash, check, credit}
|
Brackets mean that to choose one or more of the enclosed options is optional. Do not type the brackets. |
[cash | check | credit]
|
The comma means you may choose as many of the options shown as you want. Separate your choices with commas as part of the command. |
cash, check, credit
|
The pipe or vertical bar(|) means you may select only one of the options shown. |
cash | check | credit
|
An ellipsis (...) means that you can repeat the last unit as many times as you like. |
buy thing = price [cash | check | credit] [, thing = price [cash | check | credit] ]...
You must buy at least one thing and give its price. You may choose a method of payment: one of the items enclosed in square brackets. You may also choose to buy additional things: as many of them as you like. For each thing you buy, give its name, its price, and (optionally) a method of payment. |
Syntax statements (displaying the syntax and all options for a command) appear as follows:
sp_dropdevice [device_name]
or, for a command with more options:
select column_name from table_name where search_conditions
In syntax statements, keywords (commands) are in normal font and identifiers are in lowercase. Italic font shows user-supplied words.
Examples showing the use of Transact-SQL commands are printed like this:
select * from publishers
Examples of output from the computer appear as follows:
pub_id pub_name city state ------- --------------------- ----------- ----- 0736 New Age Books Boston MA 0877 Binnet & Hardley Washington DC 1389 Algodata Infosystems Berkeley CA (3 rows affected)
In this manual, most of the examples are in lowercase. However, you can disregard case when typing Transact-SQL keywords. For example, SELECT, Select, and select are the same.
Adaptive Server’s sensitivity to the case of database objects, such as table names, depends on the sort order installed on Adaptive Server. You can change case sensitivity for single-byte character sets by reconfiguring the Adaptive Server sort order. For more information, see Chapter 19,” Configuring Character Sets, Sort Orders, and Languages,” in the System Administration Guide.
Adaptive Server syntax statements use several different types of expressions. For details, see Chapter 4, “Expressions, Identifiers, and Wildcard Characters.”
Each Sybase installation that has purchased a support contract has one or more designated people who are authorized to contact Sybase Technical Support. If you cannot resolve a problem using the manuals or online help, please have the designated person contact Sybase Technical Support or the Sybase subsidiary in your area.