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), sp_login_environment calls sp_tsql_environment.

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

To change the default behavior, create new procedures and alter your LOGIN_PROCEDURE option to point to these new procedures.

For more information about setting LOGIN_PROCEDURE 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 sp_tsql_environment:

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