You can obtain a list of option settings, or the values of individual options, in a variety of ways.
To list all current system-defined option settings, call the sa_conn_options system procedure.
CALL sa_conn_options; |
To order this list alphabetically, execute the following statement:
SELECT * FROM sa_conn_options( ) ORDER BY OptionName; |
To filter the result or order by anything other than name, use a WHERE clause. For example:
SELECT * FROM sa_conn_options( ) WHERE OptionDescription LIKE '%date%' ORDER BY PropNum; |
Current system-defined option settings for your connection are also available as a subset of connection properties. You can list all connection properties using the sa_conn_properties system procedure.
CALL sa_conn_properties; |
To order this list alphabetically, you can execute the following statement:
SELECT * FROM sa_conn_properties( ) ORDER BY PropName; |
The results of the sa_conn_options and sa_conn_properties system procedures include connection-level settings for system-defined options which override user or PUBLIC settings.
For user-defined options, their values are not returned by either the sa_conn_options or sa_conn_properties system procedures. You can instead query the SYSOPTION or SYSOPTIONS catalog views directly in order to determine the value of a specific user-defined option. The following query on the SYSOPTIONS system view displays all public-level and user-level settings for all system- and user-defined options that have been permanently set:
SELECT * FROM SYSOPTIONS; |
Temporarily setting a server-defined option for a specific connection using the SET TEMPORARY OPTION statement does not cause the SYSOPTION (or SYSOPTIONS) system view to be updated. Temporary changes to option settings at the connection level are held only in server memory. To determine the current setting for a system-defined option, you should use the sa_conn_options or sa_conn_properties system procedures, the CONNECTION_PROPERTY function, or (in embedded SQL) the GET OPTION statement.
In Interactive SQL, the SET statement with no arguments lists the current setting of system-defined connection, database, and Interactive SQL options.
SET; |
In Sybase Central, select a database, and then click File » Options.
You can obtain the current setting for a single system-defined option by using the CONNECTION_PROPERTY system function. For example, the following statement reports the value of the ansi_blanks option:
SELECT CONNECTION_PROPERTY ( 'ansi_blanks' ); |
CONNECTION_PROPERTY cannot be used to obtain the values of user-defined options. See CONNECTION_PROPERTY function [System].
Within embedded SQL programs, you can use the GET OPTION statement to determine the value of an option (system- or user-defined) within your embedded SQL application. See GET OPTION statement [ESQL].
You can use the sa_server_option system procedure to instruct the database server to send a message or return an error when an attempt is made to set a database option.
You use the OptionWatchList property to create a list of the options that you want to monitor, and the OptionWatchAction property to specify the action the database server should take when an attempt is made to set an option that is being monitored.
Call the following stored procedure to instruct the database server to monitor the database options automatic_timestamp, float_as_double, and tsql_hex_constant:
CALL dbo.sa_server_option( 'OptionWatchList','automatic_timestamp,float_as_double,tsql_hex_constant' ); |
Call the following stored procedure to instruct the database server to return an error if an attempt is made to set an option specified in the OptionWatchList property:
CALL dbo.sa_server_option( 'OptionWatchAction','ERROR' ); |
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |