Executing system procedures  Messages

Chapter 1: System Procedures

Entering parameter values

If a parameter value for a system procedure contains punctuation or embedded blanks, or is a reserved word, you must enclose it in single or double quotes. If the parameter is an object name qualified by a database name or owner name, enclose the entire name in single or double quotes.

NoteDo not use delimited identifiers as system procedure parameters; they may produce unexpected results.

If a procedure has multiple optional parameters, you can supply parameters in the following form instead of supplying all the parameters:

@parametername = value

The parameter names in the syntax statements match the parameter names defined by the procedures.

For example, the syntax for sp_addlogin is:

sp_addlogin login_name, password [, defdb
	[, deflanguage [, fullname]]]

To use sp_addlogin to create a login for “susan” with a password of “wonderful”, a full name of Susan B. Anthony, and the server’s default database and language, you can use:

sp_addlogin susan, wonderful, 
    @fullname="Susan B. Anthony"

This provides the same information as the command with all the parameters specified:

sp_addlogin susan, wonderful, public_db,
    us_english, "Susan B. Anthony"

You can also use “null” as a placeholder:

sp_addlogin susan, wonderful, null, null,
    "Susan B. Anthony"

Do not enclose “null” in quotes.

SQL has no rules about the number of words you can put on a line or where you must break a line. If you issue a system procedure followed by a command, Adaptive Server attempts to execute the system procedure, then the command. For example, if you execute the following command, Adaptive Server returns the output from sp_help, then runs the checkpoint command:

sp_help checkpoint

If you specify more parameters than the number of parameters expected by the system procedure, the extra parameters are ignored by Adaptive Server.





Copyright © 2005. Sybase Inc. All rights reserved. Messages

View this book as PDF