|
| 1 | +declare @db_name sysname = 'master' |
| 2 | + |
| 3 | +begin |
| 4 | +declare @result NVARCHAR(MAX); |
| 5 | +set @result = (select compatibility_level, snapshot_isolation_state_desc, is_read_committed_snapshot_on, |
| 6 | + is_auto_update_stats_on, is_auto_update_stats_async_on, delayed_durability_desc, |
| 7 | + is_encrypted, is_auto_create_stats_incremental_on, is_arithabort_on, is_ansi_warnings_on, is_parameterization_forced |
| 8 | +from sys.databases |
| 9 | +where name = @db_name |
| 10 | +for xml raw('db'), elements); |
| 11 | +set @result += (select compatibility_level, snapshot_isolation_state_desc, is_read_committed_snapshot_on, |
| 12 | + is_auto_update_stats_on, is_auto_update_stats_async_on, delayed_durability_desc, |
| 13 | + is_encrypted, is_auto_create_stats_incremental_on, is_arithabort_on, is_ansi_warnings_on, is_parameterization_forced |
| 14 | +from sys.databases |
| 15 | +where name = 'tempdb' |
| 16 | +for xml raw('tempdb'), elements); |
| 17 | +set @result += ( |
| 18 | +select name = CONCAT('DB-CONFIG:',name), value |
| 19 | +from sys.database_scoped_configurations |
| 20 | +for xml raw, elements ); |
| 21 | +declare @tf table (TraceFlag smallint, status bit,global bit, session bit) |
| 22 | +insert into @tf execute('DBCC TRACESTATUS(-1)'); |
| 23 | +set @result += ( |
| 24 | +select name=CONCAT('TF:',TraceFlag), value=status from @tf |
| 25 | +where global=1 and session=0 |
| 26 | +for xml raw, elements |
| 27 | +); |
| 28 | +set @result += ( |
| 29 | +select name = CONCAT('CONFIG:',name), value from sys.configurations |
| 30 | +where name in ('cost threshold for parallelism','cursor threshold','fill factor (%)' |
| 31 | +,'index create memory (KB)','lightweight pooling' |
| 32 | +,'locks','max degree of parallelism','max full-text crawl range','max text repl size (B)' |
| 33 | +,'max worker threads','min memory per query (KB)','nested triggers' |
| 34 | +,'network packet size (B)','optimize for ad hoc workloads' |
| 35 | +,'priority boost','query governor cost limit','query wait (s)','recovery interval (min)' |
| 36 | +,'set working set size','user connections') |
| 37 | +for xml raw, elements |
| 38 | +); |
| 39 | +select cast(@result as xml); |
| 40 | +end; |
| 41 | + |
0 commit comments