/*
** Copyright Microsoft, Inc. 1994 - 2000
** All Rights Reserved.
*/
set nocount on
go

print ''
print 'RESET'
print '--- SYSCONFIGURES ---'
print ''

print 'sp_configure ''show advanced options'', 1'
print 'go'
print ''

print 'reconfigure with override'
print 'go'
print ''

create table #config
	(optname varchar(35),
	config_value int)
go

insert #config select optname = name, config_value = c.value
                from master.dbo.spt_values, sysconfigures c
                where type = 'C' and number = c.config
		order by name
go

declare curConfig cursor for select optname, config_value from #config
	where optname in (
	'affinity mask',
	'allow updates',
	'cursor threshold',
	'max text repl size',
	'max worker threads',
	'media retention',
	'nested triggers',
	'priority boost',
	'remote access',
	'remote login timeout',
	'remote query timeout',
	'set working set size')
for read only
open curConfig

declare @optname varchar (35),
	@config_value int,
	@line varchar (255)

while 1 = 1
	begin
	fetch curConfig into @optname, @config_value
	if @@fetch_status <> 0 break

	select @line = 'sp_configure ''' + @optname + ''', ' + convert(varchar(30), @config_value)
	print @line

	print 'go'
	print ''
	end

deallocate curConfig
go

declare @langid int,
	@language varchar(30),
	@line varchar(255)

select @langid = 0
select @langid = c.value
        from master.dbo.spt_values, sysconfigures c
        where type = 'C' and number = c.config and name = 'default language'

if @langid != 0
	begin
	select @language = name from syslanguages where langid = @langid
	if @language is not null
		begin

		if @language = 'japanese' select @language = 'Japanese'

		print '--- Transfer the default language setting ---'
		print 'declare @langid int'
		select @line = 'select @langid = langid from syslanguages where name = ''' 
			+ @language + ''' or alias = ''' + @language + ''''
		print @line
		print 'exec sp_configure ''default language'', @langid'
		print 'go'
		print ''
		end
	end

print 'sp_configure ''show advanced options'', 0'
print 'go'
print ''

print 'reconfigure with override'
print 'go'
print ''
go

