sp_tsql_environment system procedure

Function

To set connection options when users connect from jConnect or Open Client applications.

Syntax

sp_tsql_environment

Permissions

None.

See also

“sp_login_environment system procedure”

“LOGIN_PROCEDURE option”

Description

At startup, sp_login_environment is called by DBA.sp_iq_process_login, the default procedure called by the LOGIN_PROCEDURE database option. If the connection uses the TDS communication protocol (that is, if it is an Open Client or jConnect connection), then sp_login_environment in turn calls sp_tsql_environment.

This procedure sets database options so that they are compatible with default Sybase Adaptive Server Enterprise behavior.

If you wish to change the default behavior, it is recommended that you create new procedures and alter your LOGIN_PROCEDURE option to point to these new procedures.

For more information about setting the LOGIN_PROCEDURE option to the name of a new procedure, see Chapter 15, “Sybase IQ as a Data Server” in the Sybase IQ System Administration Guide.

Here is the text of the sp_tsql_environment procedure:

create procedure dbo.sp_tsql_environment()
begin
  if db_property('IQStore')='OFF' then
    -- ASA datastore
    set temporary option AUTOMATIC_TIMESTAMP='ON'
  end if;
  set temporary option ANSINULL='OFF';
  set temporary option TSQL_VARIABLES='ON';
  set temporary option ANSI_BLANKS='ON';
  set temporary option TSQL_HEX_CONSTANT='ON';
  set temporary option CHAINED='OFF';
  set temporary option QUOTED_IDENTIFIER='OFF';
  set temporary option ALLOW_NULLS_BY_DEFAULT='OFF';
  set temporary option CONTINUE_AFTER_RAISERROR='ON';
  set temporary option FLOAT_AS_DOUBLE='ON';
  set temporary option ISOLATION_LEVEL='1';
  set temporary option DATE_FORMAT='YYYY-MM-DD';
  set temporary option TIMESTAMP_FORMAT='YYYY-MM-DD HH:NN:SS.SSS';
  set temporary option TIME_FORMAT='HH:NN:SS.SSS';
  set temporary option DATE_ORDER='MDY';
  set temporary option ESCAPE_CHARACTER='OFF'
end