1.
2.
3.master下学习资源
* Sccsid = "%Z% generic/sproc/%M% %I% %G%" */
/* 4.8 1.1 06/14/90 sproc/src/configure */
/*
** Messages for "sp_configure" 17410
** Must use "langid" when referencing spt_values
**
** 17260, "Can't run %1! from within a transaction."
** 17410, "Configuration option doesn't exist."
** 17411, "Configuration option is not unique."
** 17413, "The value of the 'number of devices' must not be less than the number of active devices '%1!'
** 17414, "You can't set the default language to a language ID that is not defined in Syslanguages."
** 17415, "Configuration option value is not legal."
** 17418, "'%1!' is an invalid file command. The valid commands are 'verify', 'read', 'write', and 'restore'."
** 17419, "Configuration option changed. The SQL Server need not be rebooted since the option is dynamic.
** 18123, "Configuration option changed. The SQL Server must be rebooted before the change in effect since the option is static."
** 18124, "No matching configuration options. Here is a listing of groups:"
** 18125, "Must provide the parameter 'filename'."
** 18133, "The character set, '%1!', is invalid since it is not defined in Syscharsets."
** 18134, "The sortorder, '%1!', is invalid since it is not defined in Syscharsets."
** 18397, "Changing the value of '%1!' does not increase the amount of
** memory Adaptive Server uses.
**
** 18549, "Invalid third argument supplied: '%1!'. Valid choices are
** 'with truncate' or 'default'."
**
** 18915, "An additional %1! K bytes of memory is available for
** reconfiguration. This is the difference between 'max memory'
** and 'total logical memory'."
**
** 18916, "Changing the value of '%1!' to '%2!' increases the amount of
** memory ASE uses by %3! K."
**
** 18917, "Changing the value of '%1!' to '%2!' reduces the amount of
** memory ASE uses by %3! K. The reduced memory may be reused
** when this configure value changes, but will not be released
** until ASE restarts."
**
** 18932, "Resulting configuration value and memory use have not changed
** from previous values: new configuration value %1!, previous %2!."
**
** 19106, "Cannot change the value of configuration parameter 'global cache
** partition number' when the server is in recovery."
**
** 19107, "Cannot change the value of configuration parameter 'max concurrently
** recovered dbs' because the server is still in recovery setup."
**
** 19108, "Cannot change the configuration parameter 'max concurrently
** recovered dbs' to %1 when the server is in recovery. The only value
** allowed is 1.
**
** 19109, "Cannot change the value of configuration parameter 'global async
** prefetch limit' when the server is in recovery."
**
** 19416, "Provider class '%1!' is not a recognized messaging provider class."
**
** 19519, "Cannot run sp_configure for server '%1!' since you are not
** connecting to it."
**
** 19520, "Cannot configure '%1!' for an instance, since it is a strictly
** cluster-wide option."
**
** 19521, "Cannot configure '%1!' to cluster-wide since all active instances
** have instance-specific setting on this option."
**
** 19570, "Cannot drop the instance-specific configuration for configuration
** parameter '%1!' since the configuration setting does not exist."
**
** 19574, "An instance name needs to be provided. "
**
** 19654, "Warning: In Shared Disk Cluster, all instances share the same
** configuration file. Please run sp_configure to read the configuration
** file for all other instances to keep the configuration consistent."
** 19816, "You cannot set configuration values from inside a local temporary
** database."
** 19874, "Cannot configure '%1!' to cluster-wide since it is an
** instance-specific-only option."
** 19953, "Cannot change the value of configuration parameter 'config file
** version' because it is server generated."
**
** 19961, "WARNING: Compatibility mode will not be used when 'abstract plan dump/load/replace' is on."
** 19962, "WARNING: Compatibility mode may not be used when statement cache and literal autoparam are enabled."
** 19966, "WARNING: Enabling compatibility mode will not affect the query plans already stored in the procedure cache."
** 19967, "WARNING: The configuration option 'statement cache size' is configured with value '%1!'. Enabling compatibility mode will not affect the query plans already stored in the statement cache."
*/
create or replace procedure sp_configure
@configname varchar(255) = NULL, /* configure option name */
@configvalue int = NULL, /* configure value */
@configvalue2 varchar(255) = NULL, /* config file command/charset info */
@configvalue3 varchar(255) = NULL /* physical name of file */
as
declare @confignum int /* number of option to be configured */
declare @configcount int /* number of options like @configname */
declare @whichone int /* using english or default lang ? */
declare @cmd smallint /* configuration file command */
declare @status int /* return status for misc calls */
declare @children int /* number of children in a group */
declare @parent int /* config number of parent group */
declare @msg varchar(1024) /* temp buffer for messages */
declare @sysconfig smallint /* contents of sysconfigures.config */
declare @sysname varchar(255) /* contents of sysconfigures.comment */
declare @sysparent smallint /* contents of sysconfigures.parent */
declare @sysstatus int /* contents of sysconfigures.status */
declare @value int /* default charset/sort order id */
declare @user_displaylevel int /* user display level */
declare @numdevices int /* number of active devices */
declare @sorder_chset_id int /* current sortorder or character set id */
declare @use_wildcard tinyint /* use wildcard to search option name or not */
declare @match_count int /* number of option found by name match */
declare @cmpstate int /* Local NODE state in companionship */
declare @additional_free_memory int /* Additional Free memory */
declare @logical_memory int /* total logical memory before
change*/
declare @lmemconfignum int /* confignum for 'total logical memory' */
declare @additional_memory int /* increase in logical memory due
to change*/
declare @oldcfgvalue int /*
** previous config value for parameter
** with integer type.
*/
declare @oldcfgvalue_char varchar(255)
/*
** previous config value for parameter
** with character type.
*/
declare @defvalue varchar(255) /* default config value */
declare @fullconfigname varchar(255) /* configure option name */
declare @bvalue int /* base value after unit
converting */
declare @unit varchar(20)
declare @nocase tinyint /* case-sensitive sort order flag */
declare @rec_state varchar(30) /* the server recovery state */
declare @new_class smallint /* for valid messaging provider
** class
*/
declare @is_equal int /*
** flag to check whether configuration
** value and run value are same or not.
*/
declare @configcount2 int /* number of options for an instance. */
declare @configcount3 int /* number of options for an instance. */
declare @match_count2 int /* number of option found by name and
** instance match.
*/
declare @instanceid tinyint /* instance id */
declare @use_cluster int /* if cluster-wide value is used. */
declare @remote_instance_name varchar(255)
/* remote instance name */
declare @remote_instance_id tinyint
/* remote instance id */
declare @retstat int
declare @sqlbuf varchar(255)
declare @non_default_options int /* this option is set when nondefault
settings are to be displayed */
declare @tmp_rtms_value int /* to store the value of 'enable real time messaging'*/
declare @all_rtms_provider_set int /* to store bit map while all rtms provider enabled*/
declare @cfg_rtms_provider_mask int /* to check if the required rtms provider enabled */
declare @cfg_rtms_all_mask int /* to check if all options of rtms enabled */
declare @optlevel_def varchar(11) /* default value for optlevel */
declare @optlevel_run varchar(12) /* run value for optlevel */
declare @optlevel_curr varchar(12) /* current value for optlevel */
declare @config_value_to_check int /* value of config option to be
** checked with compatibility mode.
*/
declare @app_config int /* config number if application functionality */
declare @cha_area varchar(10) /* for configuration history auditing */
declare @cha_type varchar(30)
declare @cha_target varchar(30)
declare @cha_element varchar(255)
declare @cha_oldvalue varchar(255)
declare @cha_newvalue varchar(255)
declare @cha_mode varchar(10)
declare @cha_instanceid int
declare @cha_ret int
/*
** Disallow running sp_configure within a transaction since it might make
** recovery impossible.
** Do the @@trancount check before initializing any local variables,
** because "select" statement itself will start a transaction
** if chained mode is on.
*/
declare @nullarg char(1)
declare @dummy int
declare @status1 int
declare @gp_enabled int
declare @errnum int
declare @permerr16802 int
declare @permerr10331 int
declare @permerr10353 int
if @@trancount > 0
begin
/*
** 17260, "Can't run %1! from within a transaction."
*/
raiserror 17260, "sp_configure"
return (1)
end
else
begin
set chained off
end
select @whichone = 0
select @status = 0
select @cmd = 1
select @value = NULL
select @user_displaylevel = NULL
select @sorder_chset_id = 0
select @is_equal = 0
select @use_wildcard = 1
select @config_value_to_check = NULL
select @use_cluster = 0
select @instanceid = NULL
select @permerr16802 = 16802
select @permerr10331 = 10331
select @permerr10353 = 10353
select @errnum = 0
/*
** Check if the default sort order is case-insensitive.
*/
if ("A" = "a")
select @nocase = 1
else
select @nocase = 0
/*
** The word 'default' has a special interpretation in this procedure. We want
** it to be case-insensitive so we will recognize it when we see it. Thus, if
** @configvalue2 contains some flavor of 'default' and the sort order is not
** case-insensitive, we will force 'default' to lower case.
*/
if @nocase = 0
and @configvalue2 is not null
and lower(@configvalue2) = 'default'
select @configvalue2 = 'default'
set transaction isolation level 1
set nocount on/* Adaptive Server has expanded all '*' elements in the following statement */
/*
** Prepare values for'optimizer level'.
*/
select [master].dbo.spt_values.name, [master].dbo.spt_values.number, [master].dbo.spt_values.[type], [master].dbo.spt_values.ansi_w, [master].dbo.spt_values.low, [master].dbo.spt_values.high, [master].dbo.spt_values.msgnum into #optlevel
from master.dbo.spt_values where type = 'OL'
and name like 'ase%'
select @optlevel_def = name
from master.dbo.syscurconfigs , #optlevel
where config = 507
and number = convert(int,defvalue)
select @optlevel_run = name
from master.dbo.syscurconfigs , #optlevel
where config = 507
and number = convert(int,value2)
select @optlevel_curr = name
from master.dbo.syscurconfigs , #optlevel
where config = 507
and number = convert(int,value)
/*
** If the "default sortorder" is case insensitive dictionary sort order,
** the procedure will just print out all the options and their values
** without grouping if no option name is given.
*/
if (@nocase = 1 and @configname is NULL)
begin
/* Display all config parameters for specified instance. */
select "Parameter Name" = convert(char(30), name),
"Default" = CASE WHEN b.config = 507 THEN @optlevel_def
ELSE convert(char(11),
space(11-char_length(
convert(varchar(11), defvalue))) +
convert(varchar(11), defvalue))
END,
"Memory Used" = convert(char(11),
space(11-char_length(
convert(varchar(11), c.comment))) +
convert(varchar(11), c.comment)),
"Config Value" = CASE WHEN b.config = 507 THEN @optlevel_curr
ELSE convert(char(12),
space(12-char_length(
isnull(b.value2,
convert(char(32), b.value)))) +
isnull(b.value2, convert(char(32), b.value)))
END,
"Run Value" = CASE WHEN b.config = 507 THEN @optlevel_run
ELSE convert(char(12),
space(12-char_length(isnull(c.value2,
convert(char(32), c.value)))) +
isnull(c.value2, convert(char(32), c.value)))
END,
"Unit" = convert(char(20), c.unit),
"Type" = convert(char(20), c.type)
from master.dbo.sysconfigures b,
master.dbo.syscurconfigs c
where
b.config *= c.config
and b.config != 19
and parent != 19
return (0)
end
/* check whether nondefault settings are to be displyed.*/
if (@configname is not NULL)
begin
if "display nondefault settings" like "%" + @configname + "%"
begin
declare @countno int
/*check if configuration option is unique*/
select @countno = count(*)
from master.dbo.sysconfigures
where name like "%" + @configname + "%"
and parent != 19
/*
** if configuration option is not unique, display the duplicates
** and return
*/
if @countno > 0
begin
select name
into #temptab
from master.dbo.sysconfigures a
where name like "%" + @configname + "%"
and parent != 19
insert into #temptab values
("display nondefault settings")
raiserror 17411
print ""
print "Choose option from the following"
print ""
exec sp_autoformat #temptab
return(1)
end
/*
** if configuration option is unique set non_default_options=1,
** and make configname=NULL so that next block is bypassed
*/
else
begin
select @non_default_options = 1
select @configname = NULL
end
end
end
/* Validate the configname if it not NULL */
if @configname is not NULL
begin
/* Check the duplicate rows for cluster-wide settings. */
select @configcount = count(*)
from master.dbo.sysconfigures
where name like "%" + @configname + "%"
and parent != 19
/*
** If configure option is not unique and case-insensitive
** dictionary sort order is used, check if unique option found
** by exact name match, if so, then disable wildcard match
** for searching option name.
*/
if ((@configcount > 1
)
and @nocase = 1)
begin
/* check if unique option found by exact name match */
select @match_count = count(*)
from master.dbo.sysconfigures
where name = @configname
and parent != 19
if (@match_count = 1
)
begin
select @use_wildcard = 0 /* don't use wildcard */
if @match_count = 1
begin
select @configcount = @match_count
end
end
end
/*
** If more than one option like @configname,
** show the duplicates and return.
*/
if @configcount > 1
begin
/*
** 17411, "Configuration option is not unique."
*/
raiserror 17411
print ""
select "Parameter Name" = convert(char(30), name),
"Default" = CASE WHEN a.config = 507 THEN @optlevel_def
ELSE convert(char(11), space(11-char_length(
convert(varchar(11), defvalue)))+
convert(varchar(11), defvalue))
END,
"Memory Used" = convert(char(11), space(11-char_length(
convert(varchar(11), b.comment)))+
convert(varchar(11), b.comment)),
"Config Value" = CASE WHEN a.config = 507 THEN @optlevel_curr
WHEN a.config = 565 THEN convert(char(255), +
isnull(a.value2, convert(char(255), a.value)))
ELSE convert(char(12), space(12-char_length(
isnull(a.value2, convert(char(32), a.value)))) +
isnull(a.value2, convert(char(32), a.value)))
END,
"Run Value" = CASE WHEN a.config = 507 THEN @optlevel_run
WHEN a.config = 565 THEN convert(char(255), +
isnull(b.value2, convert(char(255), b.value)))
ELSE convert(char(12), space(12-char_length(
isnull(b.value2, convert(char(32), b.value)))) +
isnull(b.value2, convert(char(32), b.value)))
END,
"Unit" = convert(char(20), b.unit),
"Type" = convert(char(10), b.type)
from master.dbo.sysconfigures a,
master.dbo.syscurconfigs b
where
a.config *= b.config
and name like "%" + @configname + "%"
and parent != 19
and a.config != 19
order by name
/*
** If @configname like '%memory%' print message.
** 18915, "An additional %1! K bytes of memory is available
** for reconfiguration. This is the difference between
** 'max memory' and 'total logical memory'."
**
*/
if (lower(@configname) like '%memory%')
begin
select @additional_free_memory =
(max(b.value) - min(b.value)) * 2
from master.dbo.sysconfigures a,
master.dbo.syscurconfigs b
where a.name in ('max memory',
'total logical memory')
and a.config = b.config
exec sp_getmessage 18915, @msg output
print @msg,@additional_free_memory
end
return (1)
end
/*
** if it is a valid option and the @configvalue is not NULL,
** set the option
*/
if (@configcount != 0) and (@configvalue is not NULL)
begin
/* set @confignum */
select @confignum = config,
@sysstatus = status,
@fullconfigname = name
from master.dbo.sysconfigures
where name like "%" + @configname + "%"
and parent != 19
and config != 19
/* Disallow running sp_configure on "config file version". */
if (@confignum = 504)
begin
/*
** 19953, "Cannot change the value of configuration
** parameter 'config file version' because it
** is server generated."
*/
raiserror 19953
return (1)
end
/*
** Later, we will want to test whether the config value is
** actually changing. Obtain the current and default values
** for this config so we can ignore requests that result in
** no change. Here, if the parameter datatype is (var)char,
** @oldcfgvalue will be 0; if it's an int, @oldcfgvalue_char
** will be NULL.
*/
select @oldcfgvalue = b.value,
@oldcfgvalue_char = b.value2,
@defvalue = c.defvalue,
@parent = b.parent
from master.dbo.sysconfigures b,
master.dbo.syscurconfigs c
where b.config = @confignum
and b.config *= c.config
/*
** The @oldcfgvalue could be NULL if this is the
** first time configuration of an instance value.
** If this is the case, get the @oldcfgvalue from
** the cluster-wide settings.
*/
if @oldcfgvalue is NULL
begin
select @oldcfgvalue = b.value,
@oldcfgvalue_char = b.value2,
@defvalue = c.defvalue
from master.dbo.sysconfigures b,
master.dbo.syscurconfigs c
where b.config = @confignum
and b.config *= c.config
end
if (@configvalue2 = "default")
begin
select @value = 1
if @oldcfgvalue_char is null
begin
/*
** For config options in group 'Application
** Functionality', the "default" is the current
** value of option 'enable functionality group'.
** That means if 'enable functionality group' is
** 1, the 'default' value for individual feature
** is 1.
*/
if (@confignum != 543 and @parent = 49)
begin
select @configvalue = value
from master.dbo.sysconfigures
where config = 543
end
else
begin
select @configvalue = convert(int, @defvalue)
end
end
end
else
select @value = 0
/*
** If the option name is "configuration file",
** take action, then return.
*/
if @confignum = 114
begin
/*
** if the file command is not one of the valid
** commands, complain and then quit.
*/
if @configvalue2 not in ("read", "write", "restore",
"verify")
begin
/*
** print the message to show the valid
** file command
*/
raiserror 17418, @configvalue2
return(1)
end
/*
** if filename is NULL
*/
if (@configvalue3 is NULL)
begin
/* 18125, "Must provide the parameter 'filename'." */
raiserror 18125
return(1)
end
/*
** If granular permissions is not enabled then sa_role
** is required. If granular permissions is enabled
** then the permission 'manage server configuration' is
** required. proc_role and proc_auditperm will also do
** auditing if required. Both will also print error
** message if required.
*/
select @nullarg = NULL
execute @status1 = sp_aux_checkroleperm "sa_role",
"manage server configuration", @nullarg,
@gp_enabled output
/* For Auditing */
if (@gp_enabled = 0)
begin
if (proc_role("sa_role") = 0)
begin
return (1)
end
end
else
begin
select @dummy = proc_auditperm(
"manage server configuration", @status1)
end
if (@status1 != 0)
return (1)
select @cmd = case
when (@configvalue2 = "verify") then 2
when (@configvalue2 = "read" ) then 3
when (@configvalue2 = "write" ) then 4
else 5 -- "restore"
end
select @status = config_admin(@cmd,0,0,0,NULL,
@configvalue3)
select @errnum = @@error
if ((@errnum = @permerr10331)
or (@errnum = @permerr10353)
or (@errnum = @permerr16802))
begin
return 1
end
/*
** config_admin returns FALSE if error.
** True otherwise.
*/
if (@status = 1)
begin
/*
** record the configuration file operation for
** configuration history auditing
*/
select @cha_area = "SERVER"
select @cha_type = "sp_configure"
select @cha_target = @configvalue2 + " " + name
from master.dbo.sysconfigures
where config = @confignum
select @cha_element = @configvalue3
select @cha_oldvalue = NULL
select @cha_newvalue = NULL
select @cha_mode = type
from master.dbo.syscurconfigs
where config = @confignum
select @cha_instanceid = NULL
select @cha_ret = audit_config_history(
@cha_area,
@cha_type,
@cha_target,
@cha_element,
@cha_oldvalue,
@cha_newvalue,
@cha_mode,
@cha_instanceid)
return(0)
end
return (1)
end
if @confignum = 123
begin
/* get current default charset id */
select @value = value from
master.dbo.sysconfigures
where config = 131
select @sorder_chset_id = @value
if @configvalue2 is not NULL
begin
/*
** Get default charset id from name and
** validate the charset id.
*/
select @value = id
from master..syscharsets
where name = @configvalue2
and type between 1000 and 1999
if @value is null
begin
/* 18133, "The character set, '%1!', is invalid since it
** is not defined in Syscharsets."
*/
raiserror 18133, @configvalue2
return (1)
end
end
end
else
if @confignum = 131
begin
/* get current default sortord id */
select @value = value from
master.dbo.sysconfigures
where config = 123
select @sorder_chset_id = @value
if @configvalue2 is not NULL
begin
/*
** Get default sortorder id from name and
** validate the sortord id.
*/
select @value = id
from master..syscharsets
where name = @configvalue2
and type between 2000 and 2999
if @value is null
begin
/* 18134, "The sortorder, '%1!', is invalid since it
** is not defined in Syscharsets."
*/
raiserror 18134, @configvalue2
return (1)
end
end
end
/*
** If an attempt to enable a disk mirroring is made, and
** if this happens to be a server with HA services turned
** on, we disallow. Currently we do not support ASE HA
** services along with sybase mirroring.
*/
if (@confignum = 140 and @configvalue = 0)
begin
select @cmpstate = @@cmpstate
if @cmpstate >= 0
begin
/* 18816 Mirroring not allowed in ASE HA */
raiserror 18816
return(1)
end
end
/*
** If an attempt to disable disk mirroring is being made,
** ensure that there are no devices that are currently
** being mirrored.
*/
else
if (@confignum = 140 and @configvalue = 1)
begin
if (select count(*) from master.dbo.sysdevices
where status & 512 = 512) > 0
begin
/* 18750, Unable to disable disk mirroring
** because some devices are currently
** mirrored. Use 'disk unmirror' to
** unmirror these devices and then
** re-run this sp_configure command.
*/
raiserror 18570
return (1)
end
end
/*
** If this is the number of current audit table we want
** to make sure that if "with truncate" option is not
** provided new table is empty other wise fail.
*/
else
if @confignum = 260
begin
if @configvalue2 is not NULL
begin
if (@configvalue2 not in ("with truncate",
"default"))
begin
/*
** 18549, "Invalid third argument
** supplied: '%1!'. Valid
** choices are 'with truncate'
** or 'default'."
*/
raiserror 18549, @configvalue2
return(1)
end
end
else
begin
select @value = 2
end
end
/*
** global cache partition number
*/
else
if @confignum = 337
and @configvalue is not NULL
begin
select @rec_state = @@recovery_state
if (@rec_state not like "NOT_IN_RECOVERY%")
begin
raiserror 19106
return(1)
end
/*
** Partition number must be a power of 2
** between 1 and 256.
*/
if (@configvalue not between 1 and 256)
or (@configvalue & (@configvalue - 1) != 0)
begin
raiserror 18611
return(1)
end
end
/*
** If this is to change the number of maximum concurrently
** recovered dbs, check to make sure that the server is
** not currently in the tuning process. We don't allow
** change to this config parameter if the server is in
** tuning process.
** If the server is still in recovery process, the only value
** that the config parameter may be changed to is 1, which is
** to change back to do serial recovery.
*/
else
if @confignum = 415
begin
select @rec_state = @@recovery_state
if (@rec_state like "RECOVERY_TUNING%")
begin
raiserror 19107
return (1)
end
else if (@rec_state not like "NOT_IN_RECOVERY%" and
@configvalue != 1)
begin
raiserror 19108, @configvalue
return (1)
end
end
/*
** If the config parameter is "global async prefetch limit",
** do not allow this change if server is in recovery process.
*/
else
if @confignum = 303
begin
select @rec_state = @@recovery_state
if (@rec_state not like "NOT_IN_RECOVERY%")
begin
raiserror 19109
return(1)
end
end
/*
** If configure parameter is "enable real time messaging",
** check @configvalue2
**
** - null means enable for all supported messaging
** on that platform.
** - 'TIB_JMS' means enable/disable for TIBJMS only.
** - 'IBM_MQ' means enable/disable for IBM MQ only.
** - 'EAS_JMS' means enable/disable for EASJMS only.
** - 'SONICMQ_JMS' means enable for SONICMQ_JMS only.
**
** @configvalue will be changed to a bit mask.
*/
if (@value != 3) and (@confignum = 429)
begin
if (@configvalue2 is not null)
begin
/* Get the class number */
select @new_class = number
from master.dbo.spt_values
where lower(name) = lower(@configvalue2)
and type = 'X'
/* Unrecognized provider class */
if @@rowcount = 0
begin
raiserror 19416, @configvalue2
return(1)
end
/* Not a supported provider class */
if (@new_class != 12) and (@new_class != 13)
and (@new_class != 14) and (@new_class != 15)
begin
raiserror 19416, @configvalue2
return(1)
end
end
/* Get the rtms provider mask */
select @cfg_rtms_all_mask = number
from master.dbo.spt_values
where lower(name) = 'all providers'
and type = 'RT'
select @all_rtms_provider_set = sum(number)
from master.dbo.spt_values
where type = 'RT'
and low = 1
select @all_rtms_provider_set = @all_rtms_provider_set
+ @cfg_rtms_all_mask
if (@configvalue2 is not null)
begin
select @cfg_rtms_provider_mask = number
from master.dbo.spt_values
where lower(name) = lower(@configvalue2)
and type = 'RT'
and low = 1
/* Not a supported RTMS provider */
if (@cfg_rtms_provider_mask is null)
begin
raiserror 19416, @configvalue2
return(1)
end
end
else if (@configvalue != 0)
begin
select @cfg_rtms_provider_mask = @cfg_rtms_all_mask
end
else
begin
select @cfg_rtms_provider_mask = @all_rtms_provider_set
end
end
/*
** Raise warning messages if abstract plan
** dump/load/replace, literal autoparam or
** statement cache are already on when
** compatibility mode is being enabled.
*/
if (@confignum = 502 and @configvalue = 1)
begin
/* Raise warning message 19966 */
exec sp_getmessage 19966, @msg output
print @msg
/*
** Raise warning message 19961 if abstract
** plan dump/load/replace is already on.
*/
if exists (select *
from master.dbo.sysconfigures
where config in (383, 384, 385)
and value = 1)
begin
exec sp_getmessage 19961, @msg output
print @msg
end
/*
** Raise warning message 19967 if
** statement cache is already on.
*/
select @config_value_to_check = value
from master.dbo.sysconfigures
where config = 414
if (@config_value_to_check is not NULL
and @config_value_to_check != 0)
begin
exec sp_getmessage 19967, @msg output
print @msg, @config_value_to_check
/*
** Raise warning message 19962 if
** literal autoparam is already on.
*/
if exists (select *
from master.dbo.sysconfigures
where config = 462
and value = 1)
begin
exec sp_getmessage 19962, @msg output
print @msg
end
end
/*
** Raise warning message if the value of
** histogram tuning factor is not 1, the
** default value in ASE 12.5.
*/
select @config_value_to_check = value
from master.dbo.sysconfigures
where config = 433
if (@config_value_to_check is not NULL
and @config_value_to_check != 1)
begin
exec sp_getmessage 19965, @msg output
print @msg, @config_value_to_check
end
end
/*
** Raise warning messages if compatibility mode
** is already on when abstract plan dump/load/replace
** or literal autoparam is being enabled.
*/
if exists (select *
from master.dbo.sysconfigures
where config = 502 and value = 1)
begin
/*
** Check if abstract plan dump/load/replace
** is being enabled.
*/
if ((@confignum = 383 or
@confignum = 384 or
@confignum = 385) and
@configvalue = 1)
begin
exec sp_getmessage 19961, @msg output
print @msg
end
/*
** Check if literal autoparam is being enabled.
** Note that literal autoparam itself is not
** a problem but the combination of both
** statement cache and literal autoparam will
** have some effect.
*/
if (@confignum = 462 and @configvalue = 1)
begin
/* if statement cache is also on */
if exists (select *
from master.dbo.sysconfigures
where config = 414
and value != 0)
begin
exec sp_getmessage 19962, @msg output
print @msg
end
end
/*
** Check if statement cache is being enabled
** because we may have literal autoparam
** enabled already. In that case, we need to
** raise warning message for literal autoparam
** as above too.
*/
if (@confignum = 414 and @configvalue != 0)
begin
/* if literal autoparam is already on */
if exists (select *
from master.dbo.sysconfigures
where config = 462
and value = 1 )
begin
exec sp_getmessage 19962, @msg output
print @msg
end
end
end
/* get @logical_memory */
select @lmemconfignum = config
from master.dbo.sysconfigures
where name = 'total logical memory'
select @logical_memory = value
from master.dbo.syscurconfigs
where config = @lmemconfignum
select @unit = unit
from master.dbo.syscurconfigs
where config = @confignum
/* optimizer level */
if (@confignum = 507)
begin
select @configvalue = number from master.dbo.spt_values
where type = 'OL' and name = @configvalue2
end
/*
** If configure value is 0, looking for the value
** in configvalue2. As "default character set id" and
** "default sortorder_id" can be changed together, if
** @configvalue is 0 in this case, we will get syntax
** error. So for such parameters where @unit is "id",
** we will not check value of configvalue2.
*/
if (@configvalue = 0
and @configvalue2 is not NULL
and @confignum != 507
and @configvalue2 not in("default", "read", "write", "restore",
"verify", "with truncate"
)
and @unit not in ("name", "not applicable", "switch")
and (@unit != "id" or @confignum in (124, 168)))
begin
/* convert "pPkKmMgG" to equivalent "k" units */
exec @status = sp_aux_getsize @configvalue2, @bvalue output
if @status = 0
begin
/* Invalid syntax */
return(1)
end
/* sp_aux_getsize returns value in K unit. */
/*
** If we are updating "max memory" or "procedure cache size",
** do the conversion to 2k-pages ourselves
*/
if @confignum in (146, 396)
begin
select @configvalue = @bvalue / 2
end
else
begin
select @bvalue = @bvalue * 1024
/*
** normalize it according to its unit and put
** back to @configvalue.
*/
select @configvalue = config_admin(20,
@confignum, @bvalue, 0, NULL, NULL)
select @errnum = @@error
if ((@errnum = @permerr10331)
or (@errnum = @permerr10353)
or (@errnum = @permerr16802))
begin
return 1
end
end
end
/*
** If this is the number of default language, we want
** to make sure that the new value is a valid language
** ID in Syslanguages.
*/
if @confignum = 124
begin
if not exists (select *
from master.dbo.syslanguages
where langid = @configvalue)
begin
/* 0 is default language, us_english */
if @configvalue != 0
begin
/* 17414, "You can't set the default
** language to a language ID that is
** not defined in Syslanguages."
*/
raiserror 17414
return (1)
end
end
end
/*
** If this is the number of devices configuration
** parameter, we want to make sure that it's not being
** set to lower than the number of devices in sysdevices.
*/
if @confignum = 116
begin
/*
** Get the number of devices.
*/
select @numdevices = count(*)
from master.dbo.sysdevices
where status & 2 = 2
if (@configvalue < @numdevices)
begin
/* 17413, "The value of the 'number of
** devices' must not be less than the number
** of active devices '%1!'
*/
raiserror 17413, @numdevices
return (1)
end
end
/*
** Before changing the config value, if this parameter
** is "number of open databases", make sure it cannot
** be reduced during recovery.
*/
if @confignum = 105
begin
select @rec_state = @@recovery_state
if ((@rec_state not like "NOT_IN_RECOVERY%") and
(@configvalue < @oldcfgvalue))
begin
raiserror 19114
return(1)
end
end
/*
** Now we're done checking for @configvalue2 = "default", so
** we can modify it. If this is a char param and @configvalue2
** is "default", reset it to be the actual default.
*/
if @configvalue2 = "default"
and @oldcfgvalue_char is not null
begin
select @configvalue2 = @defvalue
end
/*
** Check for parameter with integer and character datatype
** that if the new and old values for the configuration
** parameter are same, then the value of configuration
** parameter will not be changed.
*/
if ((@oldcfgvalue_char is NULL AND @configvalue = @oldcfgvalue)
OR (@oldcfgvalue_char is not NULL AND @configvalue2 = @oldcfgvalue_char))
begin
/*
** Now the old and new values for the first parameter
** are same. But as "default sortorder id" and "default
** character set id" both can be changed in sp_configure
** together, check if the first parameter in sp_configure
** is one of these and if the new and old values for the
** second parameter are same, then value of both the
** parameters should not be changed. The condition
** mentioned below will always be true for other
** configuration parameters or if only one configuration
** parameter is given in sp_configure.
*/
if (@confignum not in (123, 131)) OR
(@value = @sorder_chset_id)
begin
/* Set the @is_equal flag to true */
select @is_equal = 1
end
end
/*
**If for 'enable real time messaging',
**We need to check the bitmap
*/
if (@value != 3) and (@confignum = 429)
begin
if (@oldcfgvalue = @cfg_rtms_all_mask)
select @tmp_rtms_value = @all_rtms_provider_set
else
select @tmp_rtms_value = @oldcfgvalue
select @tmp_rtms_value = @tmp_rtms_value & @cfg_rtms_provider_mask
/*
** If @configvalue != 0, it means to enable RTDS.
** Set it as 1
*/
if (@configvalue != 0) and (@configvalue != 1)
select @configvalue = 1
if (@configvalue != 0) and (@tmp_rtms_value !=0)
select @is_equal = 1
else if (@configvalue = 0) and (@tmp_rtms_value = 0)
select @is_equal = 1
else
select @is_equal = 0
if (@is_equal = 1)
select @configvalue = @oldcfgvalue
end
/*
** If the new and old values are not the same, call
** config_admin() to set the new value. Otherwise just
** set @status = 1 (success).
*/
if (@confignum != 543)
begin
select @status = case
when (@is_equal = 1) then 1
else config_admin(@cmd, @confignum,
@configvalue, @value,
NULL,
@configvalue2) end
select @errnum = @@error
if ((@errnum = @permerr10331)
or (@errnum = @permerr10353)
or (@errnum = @permerr16802))
begin
return 1
end
end
else
begin
if (@is_equal = 1)
begin
select @status = 1
end
else
begin
/*
** If the config option is 'enable functionality group',
** do not dump the new config file at this point.
*/
select @cmd = 23
/*
** For each config option in group "Application
** Functionality", call config_admin() to turn
** each feature ON/OFF.
*/
declare appgroup_cursor cursor for
select config from master.dbo.sysconfigures
where parent = 49
and config != 543
open appgroup_cursor
fetch appgroup_cursor into @app_config
while (@@sqlstatus = 0)
begin
select @status = config_admin(@cmd, @app_config,
@configvalue,
@value,
NULL,
@configvalue2)
select @errnum = @@error
if ((@errnum = @permerr10331)
or (@errnum = @permerr10353)
or (@errnum = @permerr16802))
begin
close appgroup_cursor
deallocate cursor appgroup_cursor
return 1
end
fetch appgroup_cursor into @app_config
end
close appgroup_cursor
deallocate cursor appgroup_cursor
/*
** We have configured each feature in 'Application
** Functionality' group, now configure 'enable
** functionality group' with @cmd set to 1 so that
** we will dump a new config file.
*/
select @cmd = 1
select @status = config_admin(@cmd, @confignum,
@configvalue, @value,
NULL,
@configvalue2)
select @errnum = @@error
if ((@errnum = @permerr10331)
or (@errnum = @permerr10353)
or (@errnum = @permerr16802))
begin
return 1
end
end
end
/* if successful */
if (@status = 1)
begin
if (@confignum = 507)
begin
/* default value display data */
if (@configvalue = 999999)
select @optlevel_curr = @optlevel_def,
@optlevel_run = @optlevel_def
else
select @optlevel_curr = @configvalue2,
@optlevel_run = @configvalue2
end
/* Display the new value */
select "Parameter Name" = convert(char(30), name),
"Default" = CASE WHEN b.config = 507 THEN @optlevel_def
ELSE convert(char(11), space(11-char_length(
convert(varchar(11), defvalue)))+
convert(varchar(11), defvalue))
END,
"Memory Used" = convert(char(11), space(11-char_length(
convert(varchar(11), c.comment)))+
convert(varchar(11), c.comment)),
"Config Value" = CASE WHEN b.config = 507 THEN @optlevel_curr
WHEN b.config = 565 THEN convert(char(255), +
isnull(b.value2, convert(char(255), b.value)))
ELSE convert(char(12), space(12-char_length(
isnull(b.value2, convert(char(32), b.value)))) +
isnull(b.value2, convert(char(32), b.value)))
END,
"Run Value" = CASE WHEN b.config = 507 THEN @optlevel_run
WHEN b.config = 565 THEN convert(char(255), +
isnull(c.value2, convert(char(255), c.value)))
ELSE convert(char(12), space(12-char_length(
isnull(c.value2, convert(char(32), c.value)))) +
isnull(c.value2, convert(char(32), c.value)))
END,
"Unit" = convert(char(20), c.unit),
"Type" = convert(char(20), c.type)
from master.dbo.sysconfigures b,
master.dbo.syscurconfigs c
where
b.config = @confignum and
b.config *= c.config
/*
** If the configuration value and run value are equal
** then display a message that there will not be any
** change in configuration parameter and exit.
*/
if (@is_equal = 1)
begin
if (@confignum = 507)
begin
select @configvalue2 = @optlevel_curr,
@oldcfgvalue_char = @optlevel_curr
end
/*
** 18932, Resulting configuration value
** and memory use have not changed from
** previous values: new configuration
** value %1!, previous configuration %2!
*/
exec sp_getmessage 18932, @msg output
/* for integer datatype. */
if (@oldcfgvalue_char is NULL)
begin
print @msg, @configvalue, @oldcfgvalue
end
else
begin
/* for character datatype. */
print @msg, @configvalue2, @oldcfgvalue_char
end
return(0)
end
/*
** Record the configure change for configuration
** history auditing. Config 259 is global auditing
** option, and we record this in another place. See
** the function cfg_notify_auditing().
*/
if (@confignum != 259)
begin
select @cha_area = "SERVER"
select @cha_type = "sp_configure"
select @cha_target = NULL
select @cha_element = name
from master.dbo.sysconfigures
where config = @confignum
if @oldcfgvalue_char is NULL
begin
select @cha_oldvalue =
convert(varchar(255), @oldcfgvalue)
select @cha_newvalue =
convert(varchar(255), @configvalue)
end
else
begin
select @cha_oldvalue = @oldcfgvalue_char
select @cha_newvalue = @configvalue2
end
select @cha_mode = case
when (charindex("static", type) = 1)
then "static"
when (charindex("dynamic", type) = 1)
then "dynamic"
else NULL
end
from master.dbo.syscurconfigs
where config = @confignum
select @cha_instanceid = NULL
select @cha_ret = audit_config_history(
@cha_area,
@cha_type,
@cha_target,
@cha_element,
@cha_oldvalue,
@cha_newvalue,
@cha_mode,
@cha_instanceid)
end
/*
** print reboot message if this option is not
** dynamic.
*/
if ((@sysstatus & 8) = 8)
begin
exec sp_getmessage 17419, @msg output
print @msg
end
else
begin
exec sp_getmessage 18123, @msg output
print @msg
end
/*
** Lets us calculate @additional_memory i.e. the
** increase in 'total logical memory'
*/
select @additional_memory =
(value - @logical_memory) * 2
from master.dbo.syscurconfigs
where config = @lmemconfignum
/*
** print additional memory message
*/
if (@additional_memory > 0)
begin
/*
** 18916, Changing the value of '%1!' to '%2!'
** increases the amount of memory ASE uses
** by %3! K.
*/
if (@unit != "name")
begin
exec sp_getmessage 18916, @msg output
print @msg, @fullconfigname,
@configvalue, @additional_memory
end
else
begin
/*
** For configure options with name
** as their units, they use
** configvalue2 (type of varchar)
** to specify the intended value
** insteading of configvalue (type
** of int).
*/
exec sp_getmessage 18916, @msg output
print @msg, @fullconfigname,
@configvalue2, @additional_memory
end
end
else if (@additional_memory < 0)
begin
/*
** 18917, Changing the value of '%1!' to '%2!'
** reduces the amount of memory ASE uses
** by %3! K. The reduced memory may be
** reused when this configure value changes,
** but will not be released until ASE restarts.
*/
select @additional_memory = @additional_memory * -1
if (@unit != "name")
begin
exec sp_getmessage 18917, @msg output
print @msg, @fullconfigname,
@configvalue, @additional_memory
end
else
begin
exec sp_getmessage 18917, @msg output
print @msg, @fullconfigname,
@configvalue2, @additional_memory
end
end
else
begin
/*
** 18397, Changing the value of '%1!'
** does not increase the amount of
** memory Adaptive Server uses.
*/
exec sp_getmessage 18397, @msg output
print @msg, @fullconfigname
end
return(0)
end
else
return(1)
end
end
/*
** @configcount=0 implies @configname is not valid
** @configname=NULL implies displaying all the parameters except for
** the parameters with the config number equal to 19 or the parent equal
** to 19 since those parameters are displayed by sp_cacheconfig.
*/
if (@configcount = 0)
begin
/* 18124, "No matching configuration options.
** Here is a listing of groups:"
*/
raiserror 18124
select distinct convert(char(50), name)
from master.dbo.sysconfigures
where config < 100
and parent != 19
and config != 19
order by name
return(1)
end
else if (@configname is NULL and @non_default_options is NULL)
begin
select @configname = "Config"
end
/*
** retrieve the display level from sysattributes
*/
select @user_displaylevel = int_value from master.dbo.sysattributes where
class = 4 AND
attribute = 0 AND
object_type = 'L' AND
object = suser_id()
/*
** set the default display level to 10 if it is not defined in sysattributes
*/
if (@user_displaylevel is NULL)
select @user_displaylevel = 10
/*
** If non_default_options is set, display only nondefault settings depending
** on current display level and return
*/
if(@non_default_options = 1)
begin
/* Display all config parameters for specified instance. */
if @configvalue3 is not NULL
begin
if @configvalue3 != @@instancename
begin
raiserror 19519, @configvalue3
return (1)
end
else
begin
select Parameter_Name = convert(char(30), name),
Default_Value = convert(varchar(11), defvalue),
Memory_Used = convert(varchar(11), c.comment),
Config_Value = isnull(b.value2,
convert(char(32), b.value)),
Run_Value = isnull(c.value2,
convert(char(32), c.value)),
Unit = convert(char(20), c.unit),
Type_ = convert(char(10), c.type)
into #temptable1
from master.dbo.sysconfigures b,
master.dbo.syscurconfigs c
where
b.config = c.config
and (c.defvalue != isnull(b.value2,
convert(char(32), b.value))
or c.defvalue != isnull(c.value2,
convert(char(32), c.value)))
and c.config != 114
/* Exclude option 'configuration file' */
and c.type != "read-only"
and display_level <= @user_displaylevel
exec sp_autoformat #temptable1,
@selectlist = "'Parameter Name' = Parameter_Name,
'Default'= Default_Value,'Memory Used' = Memory_Used,
'Config Value '= Config_Value,'Run Value'= Run_Value,
'Unit' = Unit,'Type'= Type_",
@orderby = "order by Parameter_Name"
return (0)
end
end
if @@system_view = "instance"
begin
/*
** Display the information of the config parameter
** for the current instance as well as the cluster-wide
** one.
*/
select Parameter_Name = convert(char(30), name),
Default_Value = convert(varchar(11), defvalue),
Memory_Used = convert(varchar(11), c.comment),
Config_Value = isnull(b.value2, convert(char(32), b.value)),
Run_Value = isnull(c.value2, convert(char(32), c.value)),
Unit = convert(char(20), c.unit),
Type_ = convert(char(10), c.type)
into #temptable3
from master.dbo.sysconfigures b,
master.dbo.syscurconfigs c
where
b.config = c.config
and (c.defvalue != isnull(b.value2, convert(char(32), b.value))
or c.defvalue != isnull(c.value2, convert(char(32), c.value)))
and c.config != 114
/* Exclude option 'configuration file' */
and c.type != "read-only"
and display_level <= @user_displaylevel
exec sp_autoformat #temptable3,
@selectlist = "'Parameter Name' = Parameter_Name,
'Default'= Default_Value,'Memory Used' = Memory_Used,
'Config Value '= Config_Value,'Run Value'= Run_Value,
'Unit' = Unit,'Type'= Type_",
@orderby = "order by Parameter_Name"
end
else
begin
/*
** When system_view is set to 'cluster', we need to
** display the config info across all instances. This
** includes two part: one is the cluster-wide config
** setting whose instanceid is NULL; the other
** part is the info for each instance who has a valid
** instanceid.
*/
select distinct
Parameter_Name = convert(char(30), name),
Default_Value = convert(varchar(11), defvalue),
Memory_Used = convert(varchar(11), c.comment),
Config_Value = isnull(b.value2, convert(char(32), b.value)),
Run_Value = isnull(c.value2, convert(char(32), c.value)),
Unit = convert(char(20), c.unit),
Type_ = convert(char(10), c.type)
into #temptable
from master.dbo.sysconfigures b, master.dbo.syscurconfigs c
where
b.config = c.config
and (c.defvalue != isnull(b.value2,
convert(char(32), b.value))
or c.defvalue != isnull(c.value2,
convert(char(32), c.value)))
and c.config != 114
/* Exclude option 'configuration file' */
and c.type != "read-only"
and display_level <= @user_displaylevel
exec sp_autoformat #temptable,
@selectlist = "'Parameter Name' = Parameter_Name,
'Default'= Default_Value,'Memory Used' = Memory_Used,
'Config Value '= Config_Value,'Run Value'= Run_Value,
'Unit' = Unit,'Type'=Type_",
@orderby = "order by Parameter_Name"
end
return (0)
end
/*
** If @use_wildcard = 0 and the default sortorder is case-insensitive
** dictionary sort order, use exact match: name = @configname to get row,
** otherwise use wildcard match: name like "%" + @configname + "%".
*/
if (@use_wildcard = 0 and @nocase = 1)
begin
select @confignum = config,
@parent = config,
@sysname = name,
@sysstatus = status
from master.dbo.sysconfigures
where name = @configname
and config != 19
end
else
begin
select @confignum = config,
@parent = config,
@sysname = name,
@sysstatus = status
from master.dbo.sysconfigures
where name like "%" + @configname + "%"
and config != 19
end
select @children = count(*)
from master.dbo.sysconfigures
where parent = @confignum
if @children = 0
begin
/* @@nestlevel is problem area if a sproc calls sp_configure */
/* could pass in another param when recursing */
if @@nestlevel > 1
begin
/* reached a leaf, notify parent */
return(1)
end
else
begin
begin
/* Display the information of the config parameter
** for the current server as well as the cluster-wide
** one. Instanceid is NULL meaning this is the
** cluster-wide configuration.
*/
select "Parameter Name" = convert(char(30), name),
"Default" = CASE WHEN b.config = 507 THEN @optlevel_def
ELSE convert(char(11), space(11-char_length(
convert(varchar(11), defvalue)))+
convert(varchar(11), defvalue))
END,
"Memory Used" = convert(char(11), space(11-char_length(
convert(varchar(11), c.comment)))+
convert(varchar(11), c.comment)),
"Config Value" = CASE WHEN b.config = 507 THEN @optlevel_curr
WHEN b.config = 565 THEN convert(char(255), +
isnull(b.value2, convert(char(255), b.value)))
ELSE convert(char(12), space(12-char_length(
isnull(b.value2, convert(char(32), b.value)))) +
isnull(b.value2, convert(char(32), b.value)))
END,
"Run Value" = CASE WHEN b.config = 507 THEN @optlevel_run
WHEN b.config = 565 THEN convert(char(255), +
isnull(c.value2, convert(char(255), c.value)))
ELSE convert(char(12), space(12-char_length(
isnull(c.value2, convert(char(32), c.value)))) +
isnull(c.value2, convert(char(32), c.value)))
END,
"Unit" = convert(char(20), c.unit),
"Type" = convert(char(20), c.type)
from master.dbo.sysconfigures b,
master.dbo.syscurconfigs c
where
b.config *= c.config
and name like "%" + @configname + "%"
and b.config != 19
and parent != 19
end
end
return (0)
end
else
begin
select @msg = "Group: " + @sysname
print ""
print @msg
print ""
/* this poor guy has kids, so recurse to leaves */
declare config_curs cursor for
select config, name, parent
from master.dbo.sysconfigures
where parent = @parent
order by name
open config_curs
fetch config_curs into @sysconfig, @sysname, @sysparent
while (@@sqlstatus = 0)
begin
execute @status = sp_configure @sysname
if (@status = 1)
begin
/*
** this guy has leaves as kids,
** so print out the leaves with
** display level <= @user_displaylevel
** Note: If a config parameter has more than one
** parent, the extra parents are stored in
** 'sysattribures'.
*/
create table #configure_temp (config int)
insert into #configure_temp
select distinct a.config
from master.dbo.sysconfigures a,
master.dbo.syscurconfigs b
where
display_level <= @user_displaylevel
and parent = @parent
and a.config != 19
and a.config = b.config
union
select distinct config
from master.dbo.syscurconfigs,
master.dbo.sysattributes
where
display_level <= @user_displaylevel
and class = 4
and attribute = 1
and object_type = 'CP'
and int_value = @parent
and object = config
and config != 19
if exists (select * from #configure_temp)
begin
/*
** If system_view is 'instance', display
** the config info for the current instance
** as well as the cluster-wide one.
*/
begin
select
"Parameter Name" = convert(char(30), name),
"Default" = CASE WHEN b.config = 507
THEN @optlevel_def
ELSE convert(char(11),
space(11-char_length(
convert(varchar(11), defvalue))) +
convert(varchar(11), defvalue))
END,
"Memory Used" =
convert(char(11),
space(11-char_length(
convert(varchar(11), c.comment))) +
convert(varchar(11), c.comment)),
"Config Value" = CASE WHEN b.config = 507
THEN @optlevel_curr
ELSE convert(char(12),
space(12-char_length(
isnull(b.value2,
convert(char(32), b.value)))) +
isnull(b.value2,
convert(char(32), b.value)))
END,
"Run Value" = CASE WHEN b.config = 507
THEN @optlevel_run
ELSE convert(char(12),
space(12-char_length(
isnull(c.value2,
convert(char(32), c.value)))) +
isnull(c.value2,
convert(char(32), c.value)))
END,
"Unit" = convert(char(20), c.unit),
"Type" = convert(char(20), c.type)
from master.dbo.sysconfigures b,
master.dbo.syscurconfigs c
where b.config in
(select config
from #configure_temp)
and b.config = c.config
order by name
end
end
drop table #configure_temp
close config_curs
deallocate cursor config_curs
return(0)
end
else
begin
/*
** this lucky guy has grandkids, so, continue
*/
fetch config_curs into
@sysconfig, @sysname, @sysparent
end
end
close config_curs
deallocate cursor config_curs
return(0)
end
4.cmd命令行连接和查阅
后续补充 SybaseIQ分析数据