I had the need to write this today, in case useful to anyone / starter for a larger script?? SELECT name, CASE WHEN T_SystemDB = 1 OR compatibility_level = 100 THEN '' ELSE 'compatibility_level=' + CONVERT(varchar(20), compatibility_level) + ' ' END + CASE WHEN collation_name = 'SQL_Latin1_General_CP1_CI_AS' THEN '' ELSE 'collation_name=' + COALESCE(collation_name, 'NULL') + ' ' COLLATE SQL_Latin1_General_CP1_CI_AS END + CASE WHEN user_access_desc = 'MULTI_USER' THEN '' ELSE 'user_access=' + COALESCE(user_access_desc, 'NULL') + ' ' END + CASE WHEN is_read_only = 0 THEN '' ELSE 'is_read_only=' + CONVERT(varchar(20), is_read_only) + ' ' END + CASE WHEN is_auto_close_on = 0 THEN '' ELSE 'is_auto_close_on=' + CONVERT(varchar(20), is_auto_close_on) + ' ' END + CASE WHEN is_auto_shrink_on = 0 THEN '' ELSE 'is_auto_shrink_on=' + CONVERT(varchar(20), is_auto_shrink_on) + ' ' END + CASE WHEN state = 0 THEN '' ELSE 'state=' + COALESCE(state_desc, 'NULL') + ' ' END + CASE WHEN is_in_standby = 0 THEN '' ELSE 'is_in_standby=' + CONVERT(varchar(20), is_in_standby) + ' ' END + CASE WHEN is_cleanly_shutdown = 0 THEN '' ELSE 'is_cleanly_shutdown=' + CONVERT(varchar(20), is_cleanly_shutdown) + ' ' END + CASE WHEN is_supplemental_logging_enabled = 0 THEN '' ELSE 'is_supplemental_logging_enabled=' + CONVERT(varchar(20), is_supplemental_logging_enabled) + ' ' END + CASE WHEN T_SystemDB = 1 OR snapshot_isolation_state = 0 THEN '' ELSE 'snapshot_isolation_state=' + COALESCE(snapshot_isolation_state_desc, 'NULL') + ' ' END + CASE WHEN T_SystemDB = 1 OR is_read_committed_snapshot_on = 1 THEN '' ELSE 'READ_COMMITTED_SNAPSHOT=OFF ' END + CASE WHEN T_SystemDB = 1 OR recovery_model = 1 THEN '' ELSE 'recovery_model=' + COALESCE(recovery_model_desc, 'NULL') + ' ' END + CASE WHEN page_verify_option = 2 THEN '' ELSE 'page_verify_option=' + COALESCE(page_verify_option_desc, 'NULL') + ' ' END + CASE WHEN is_auto_create_stats_on = 1 THEN '' ELSE 'is_auto_create_stats_on=' + CONVERT(varchar(20), is_auto_create_stats_on) + ' ' END + CASE WHEN is_auto_update_stats_on = 1 THEN '' ELSE 'is_auto_update_stats_on=' + CONVERT(varchar(20), is_auto_update_stats_on) + ' ' END + CASE WHEN is_auto_update_stats_async_on = 0 THEN '' ELSE 'is_auto_update_stats_async_on=' + CONVERT(varchar(20), is_auto_update_stats_async_on) + ' ' END + CASE WHEN is_ansi_null_default_on = 0 THEN '' ELSE 'is_ansi_null_default_on=' + CONVERT(varchar(20), is_ansi_null_default_on) + ' ' END + CASE WHEN is_ansi_nulls_on = 0 THEN '' ELSE 'is_ansi_nulls_on=' + CONVERT(varchar(20), is_ansi_nulls_on) + ' ' END + CASE WHEN is_ansi_padding_on = 0 THEN '' ELSE 'is_ansi_padding_on=' + CONVERT(varchar(20), is_ansi_padding_on) + ' ' END + CASE WHEN is_ansi_warnings_on = 0 THEN '' ELSE 'is_ansi_warnings_on=' + CONVERT(varchar(20), is_ansi_warnings_on) + ' ' END + CASE WHEN is_arithabort_on = 0 THEN '' ELSE 'is_arithabort_on=' + CONVERT(varchar(20), is_arithabort_on) + ' ' END + CASE WHEN is_concat_null_yields_null_on = 0 THEN '' ELSE 'is_concat_null_yields_null_on=' + CONVERT(varchar(20), is_concat_null_yields_null_on) + ' ' END + CASE WHEN is_numeric_roundabort_on = 0 THEN '' ELSE 'is_numeric_roundabort_on=' + CONVERT(varchar(20), is_numeric_roundabort_on) + ' ' END + CASE WHEN is_quoted_identifier_on = 0 THEN '' ELSE 'is_quoted_identifier_on=' + CONVERT(varchar(20), is_quoted_identifier_on) + ' ' END + CASE WHEN is_recursive_triggers_on = 0 THEN '' ELSE 'is_recursive_triggers_on=' + CONVERT(varchar(20), is_recursive_triggers_on) + ' ' END + CASE WHEN is_cursor_close_on_commit_on = 0 THEN '' ELSE 'is_cursor_close_on_commit_on=' + CONVERT(varchar(20), is_cursor_close_on_commit_on) + ' ' END + CASE WHEN is_local_cursor_default = 0 THEN '' ELSE 'is_local_cursor_default=' + CONVERT(varchar(20), is_local_cursor_default) + ' ' END + CASE WHEN T_SystemDB = 1 OR is_fulltext_enabled = 1 THEN '' ELSE 'is_fulltext_enabled=' + CONVERT(varchar(20), is_fulltext_enabled) + ' ' END + CASE WHEN is_trustworthy_on = 0 THEN '' ELSE 'is_trustworthy_on=' + CONVERT(varchar(20), is_trustworthy_on) + ' ' END + CASE WHEN T_SystemDB = 1 OR is_db_chaining_on = 0 THEN '' ELSE 'is_db_chaining_on=' + CONVERT(varchar(20), is_db_chaining_on) + ' ' END + CASE WHEN is_parameterization_forced = 0 THEN '' ELSE 'is_parameterization_forced=' + CONVERT(varchar(20), is_parameterization_forced) + ' ' END + CASE WHEN is_master_key_encrypted_by_server = 0 THEN '' ELSE 'is_master_key_encrypted_by_server=' + CONVERT(varchar(20), is_master_key_encrypted_by_server) + ' ' END + CASE WHEN is_published = 0 THEN '' ELSE 'is_published=' + CONVERT(varchar(20), is_published) + ' ' END + CASE WHEN is_subscribed = 0 THEN '' ELSE 'is_subscribed=' + CONVERT(varchar(20), is_subscribed) + ' ' END + CASE WHEN is_merge_published = 0 THEN '' ELSE 'is_merge_published=' + CONVERT(varchar(20), is_merge_published) + ' ' END + CASE WHEN is_distributor = 0 THEN '' ELSE 'is_distributor=' + CONVERT(varchar(20), is_distributor) + ' ' END + CASE WHEN is_sync_with_backup = 0 THEN '' ELSE 'is_sync_with_backup=' + CONVERT(varchar(20), is_sync_with_backup) + ' ' END + CASE WHEN is_broker_enabled = 0 THEN '' ELSE 'is_broker_enabled=' + CONVERT(varchar(20), is_broker_enabled) + ' ' END + CASE WHEN log_reuse_wait IN (0, 2) THEN '' ELSE 'log_reuse_wait=' + COALESCE(log_reuse_wait_desc, 'NULL') + ' ' END + CASE WHEN is_date_correlation_on = 0 THEN '' ELSE 'is_date_correlation_on=' + CONVERT(varchar(20), is_date_correlation_on) + ' ' END + CASE WHEN is_cdc_enabled = 0 THEN '' ELSE 'is_cdc_enabled=' + CONVERT(varchar(20), is_cdc_enabled) + ' ' END + CASE WHEN is_encrypted = 0 THEN '' ELSE 'is_encrypted=' + CONVERT(varchar(20), is_encrypted) + ' ' END + CASE WHEN is_honor_broker_priority_on = 0 THEN '' ELSE 'is_honor_broker_priority_on=' + CONVERT(varchar(20), is_honor_broker_priority_on) + ' ' END-- SELECT TOP 100 *FROM( SELECT [T_SystemDB] = CASE WHEN name IN ('master', 'model', 'msdb', 'tempdb') THEN 1 ELSE 0 END, * FROM sys.databases ) AS XWHERE 1=1-- AND name = 'MyDatabase'ORDER BY 1-T_SystemDB, name