dumping ground for code that might be useful sometime, somewhere. Beware the formatting mangle of the blog post...

Wednesday, March 7, 2007

TSQL: Generate sp_configure commands

Generate sp_configure commands from a server to replay on another or after a rebuild. Correct spelling of create before runnig

SET NOCOUNT ON

SELECT '/****--' + @@SERVERNAME

EXEC sp_configure 'show advanced options' , '1'
RECONFIGURE WITH OVERRIDE

SELECT '****/'

CREAT TABLE #temp
(
name varchar(35) ,
minimum varchar(12) ,
maximum varchar(12) ,
config_value varchar(12) ,
run_value varchar(12) ,
)
INSERT #temp
exec sp_configure

SELECT 'EXEC sp_configure ''' + LTRIM(RTRIM(name)) + ''' , ''' + LTRIM(RTRIM(run_value)) + '''' FROM #temp

DROP TABLE #temp

No comments: