User's Guide
PART 1. Working with Databases
CHAPTER 3. Working with Database Objects
Adaptive Server Anywhere includes two utilities for working with database objects: Sybase Central and Interactive SQL. In addition, SQL Modeler can be used for designing and creating whole databases.
You can use Sybase Central to create, modify, and delete all kinds of database objects, including tables, procedures, triggers, views, indexes, users and groups.
This chapter is concerned with the SQL statements for working with database objects. If you are using Sybase Central, these SQL statements are generated for you. The primary source of information about Sybase Central is the Sybase Central online Help. In this chapter, only brief pointers are given for tasks that you can carry out using Sybase Central.
For an introduction to using Sybase Central, see Managing Databases with Sybase Central.
Interactive SQL is a utility for entering SQL statements. If you are using Interactive SQL to work with your database schema, instead of executing the SQL statements one at a time you should build up the set of commands in an Interactive SQL command file. This file can then be executed in Interactive SQL to build the database.
If you are using a tool other than Interactive SQL, all the information in this chapter concerning SQL statements still applies.
If you have not created your database using command files, you can create a command file that would recreate your database by unloading the database.
For a description of the Unload utility, see The Unload utility.
An Interactive SQL command file is a text file with semicolons placed at the end of commands (see Command Files) as shown below.
CREATE TABLE t1 ( .. ); CREATE TABLE t2 ( .. ); CREATE INDEX i2 ON t2 ( .. ); ..
AnInteractive SQL command file is usually given a name with the extension .sql. To execute a command file, either paste the contents of the file into the Interactive SQL command window (if the file has less than 500 lines) or enter a command that reads the file into the command window. For example:
read makesdb
reads the Interactive SQL commands in the file makedb.sql.