In Interactive SQL, use the CREATE DATABASE statement to create databases. You need to connect to an existing database before you can use this statement.
To create a new database (SQL)
Start a database server named sample.
dbeng11 -n sample
Start Interactive SQL.
Connect to an existing database. If you don't have a database, you can connect to the utility database utility_db. See Connecting to the utility database.
Execute a CREATE DATABASE statement.
Create a database file in the c:\temp directory with the file name temp.db.
CREATE DATABASE 'c:\\temp\\temp.db';
The directory path is relative to the database server. You set the permissions required to execute this statement on the server command line, using the -gu option. The default setting requires DBA authority.
The backslash is an escape character in SQL, and must be doubled in some cases. The \x and \n sequences can be used to specifying hexadecimal and newline characters. Letters other than n and x do not have any special meaning if they are preceded by a backslash. Here are some examples where this is important.
CREATE DATABASE 'c:\\temp\\\x41\x42\x43xyz.db';
The initial \\ sequence represents a backslash. The \x sequences represent the characters A, B, and C, respectively. The file name here is ABCxyz.db.
CREATE DATABASE 'c:\temp\\nest.db';
To avoid having the \n sequence interpreted as a newline character, the backslash is doubled.
See Escape sequences.
|Send feedback about this page via email or DocCommentXchange||Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0|