![]() | ![]() |
Home |
|
|
Enterprise SQL Server Manager Reference Manual |
|
| Chapter 1: Introduction |
|
| The Enterprise SQL Server Manager Command Line Interface |
The Enterprise SQL Server Manager command line interface (CLI) follows a consistent and logical syntax that makes it easy to remember and use Enterprise SQL Server Manager commands. This section outlines the syntax conventions common to all Enterprise SQL Server Manager commands. For a description of the notational conventions that this document uses, see "Notational Conventions".
All Enterprise SQL Server Manager command names begin with the prefix "s" to insure uniqueness and to identify them as Sybase commands. A verb usually follows the "s" prefix. The most common verbs are:
Verb | Action |
|---|---|
comp | compare |
copy | copy |
crt | create |
del | delete |
get | get |
set | set |
An object type follows the verb and indicates the kind of object the command manipulates or accesses. Object types include login, server, db (for "database"), dev (for "device"), and others.
Understanding this convention, you could guess that a command named:
scrtlogin
creates a SQL Server login.
Command options modify the behavior of a command and specify the values you want a command to use.
Many command options also require values. These values can be predefined keywords like TRUE or ENABLE, numbers, or names that identify servers, databases, server logins, and other objects. Also, some command options accept lists of values. The following sections describe the different kinds of option values the CLI accepts and the rules for using them.
Like command options, most keyword values (such as primary, secondary, true, and disable) are not case-sensitive, and unambiguous substrings for keywords are acceptable (for example, tr for true).
SQL Server keywords (such as sa_role, statistics io, and so forth) are case-sensitive, and you must specify them exactly as they are known to SQL Server. Also, you must enter most SQL Server keywords in their entirety-substrings are illegal.
SQL Server object names, such as login and server names, are also case-sensitive. Here, too, you must enter complete object names-substrings are illegal. The names must comply with the SQL Server rules for identifiers (see SQL Server Reference Manual). Most commands use -name and -names options to specify object names.
Boolean option values produce a value of 0 or 1. You can use any of the Boolean keywords listed in Table 1-2 with most command options that accept a Boolean value:
1 | 0 |
|---|---|
true | false |
yes | no |
on | off |
enable | disable |
1 | 0 |
The exception to this is when a Boolean option value is serving as a SQL Server keyword (for instance, in enabling or disabling a SQL Server database option). In these cases, you must supply the Boolean keyword exactly as specified in the Enterprise SQL Server Manager command syntax.
Numeric values can include the digits 0 through 9. Thus, numeric option values must always be positive integers.
Some command options accept only a single value; others accept a list of items. For example, most sget, scopy, and scomp commands have a -names option that accepts a list of one or more object names. When a command option accepts a list of items, the following rules apply:
-roles sa_role,oper_role
specifies an option value list with two items: sa_role and oper_role.
-roles "sa_role oper_role"
specifies a list with two items separated by a space: sa_role and oper_role. Because the list contains a space, the list is enclosed in double quotation marks.
-devices "default 4, db_dev 2"
specifies a list with two items (default 4 and db_dev 2), where each item contains two elements (a device name and a size).
-config "'recovery interval' 3"
specifies a list item with two elements: the configuration variable recovery interval and the value 3. Because recovery interval is a list element that contains a space, it is enclosed in single quotation marks.
You can often use wildcards in option value lists that specify SQL Server object names. Wildcards are special characters that represent one or more characters. Any character or set of characters can replace a wildcard character. Wildcards combined with other characters form a pattern-matching string to save time when referring to a large group of names. To enable wildcard matching for names listed in a command, use the -wildcard option. For example, suppose you want to specify all database user names beginning with "w." Instead of typing each name in the list, one by one, as in:
-names "woodyard, woode, williams"
you can enter a pattern-matching string that contains the percent sign (%) wildcard character to represent zero or more characters:
-names w% -wildcard
The pattern "w%" specifies any names that begin with "w" followed by zero or more characters. Table 1-3 lists the wildcards that Enterprise SQL Server Manager accepts:
Wildcard | Meaning |
|---|---|
% | Any string of zero or more characters. |
_ (underscore) | Any single character. |
[chars] | Any single character in the list or range of characters chars. A list is any string of characters. For example, [a2br] matches the single characters "a", "2", "b", or "r". Note that the lists [abcdef] and [fcbdae] match the same set of characters. You can use a dash (char1-char2) to specify a range of characters. All characters in the sort order between char1 and char2 (inclusive) match the wildcard. For example, [A-Za-z] matches any alphabetic character in the 7-bit ASCII sort order. |
[^chars] | Matches any single character not in the specified list or range. For example, [^a-c] matches any single character that is not "a", "b", or "c" (in the 7-bit ASCII sort order). |
To use a wildcard character literally, enclose it in square brackets ( [ ] ). For example:
-names "user[_][a-c]" -wildcard
matches "user_a" and "user_b" but not "user_a." The following are some more examples of using wildcards in option lists:
Gets information on all logins beginning with the letter "j."
Gets information on all two-character logins beginning with "s."
Gets information on the login "guest" and all login names that begin with "A" or "B."
Gets information on the login "guest" and all login names ending in a digit.
Most commands accept one or more options. Some options are mandatory; you must include them for the command to work successfully. In many cases, if you do not include an option, the command uses a default value. For example, many commands accept a -server option that specifies the managed server in which you want the command to work. If you omit this option, the command uses the default value (in this case, the current managed server). Surrounding brackets ( "[" and "]" ) in the command syntax identify optional command elements.
|
|