Overview  Pattern matching

Chapter 2: Catalog Stored Procedures

Specifying optional parameters

If a parameter value for a catalog stored 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 catalog stored procedure parameters. Doing so may produce unexpected results.

In many cases, it is more convenient to supply parameters to the catalog stored procedures in the form:

@parametername = value

than to supply all the parameters. The parameter names in the syntax statements match the parameter names defined by the procedures.

For example, the syntax for sp_columns is:

sp_columns table_name [, table_owner] 
	[, table_qualifier] [, column_name]

To use sp_columns to find information about a particular column, you can use:

sp_columns publishers, @column_name = "pub_id"

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

sp_columns publishers, "dbo", "pubs2", "pub_id"

You can also use “null” as a placeholder:

sp_columns publishers, null, null, "pub_id"

If you specify more parameters then the number of parameters expected by the system procedure, Adaptive Server ignores the extra parameters.





Copyright © 2005. Sybase Inc. All rights reserved. Pattern matching

View this book as PDF