Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sysdatabases

  No additional text.


Syntax
CREATE VIEW sys.sysdatabases AS
	SELECT d.name, dbid = convert(smallint, d.database_id),
		sid = d.owner_sid,
		mode = convert(smallint, 0),
		status = convert(int,
				(d.is_auto_close_on * 1)
				-- Restoring(1) Recovering(2) Emergency(5) Offline(6)
				+ (case d.state when 1 then 32 when 2 then 128 when 5 then 32768+256 when 6 then 512 else 0 end)
				+ (d.is_read_only * 1024)
				+ (d.is_in_standby * 2097152)
				+ (d.is_auto_shrink_on * 4194304)
				+ (d.is_cleanly_shutdown * 1073741824)
				+ (case d.user_access when 1 then 4096 when 2 then 2048 else 0 end)
				+ (case d.recovery_model when 2 then 4 when 3 then 8 when 4 then 12 else 0 end)
				+ (case d.page_verify_option when 1 then 16 when 2 then 65536 else 0 end)),
		status2 = convert(int,
				(d.is_auto_create_stats_on * 16777216)
				+ (d.is_auto_update_stats_on * 1073741824)
				+ (d.is_ansi_null_default_on * 16384)
				+ (d.is_ansi_nulls_on * 67108864)
				+ (d.is_ansi_padding_on * 8192)
				+ (d.is_ansi_warnings_on * 268435456)
				+ (d.is_arithabort_on * 4096)
				+ (d.is_concat_null_yields_null_on * 65536)
				+ (d.is_numeric_roundabort_on * 2048)
				+ (d.is_quoted_identifier_on * 8388608)
				+ (d.is_recursive_triggers_on * 131072)
				+ (d.is_cursor_close_on_commit_on * 33554432)
				+ (d.is_local_cursor_default * 1048576)
				+ (d.is_fulltext_enabled * 536870912)
				+ (d.is_db_chaining_on * 1024)),
		crdate = d.create_date,
		reserved = convert(datetime, 0),
		category = convert(int,
				(d.is_published * 1)
				+ (d.is_subscribed * 2)
				+ (d.is_merge_published * 4)
				+ (d.is_distributor * 16)
				+ (d.is_sync_with_backup * 32)),
		cmptlevel = d.compatibility_level,
		filename = f.physical_name,
		version = convert(smallint, DatabaseProperty(d.name, 'Version'))
	FROM sys.databases d
	LEFT JOIN sys.master_files$ f
	ON f.database_id = d.database_id AND f.recovery_unit_id = 0 AND f.file_id = 1

 
Last revision 2008RTM
See also

  sp_ActiveDirectory_Obj (Procedure)
sp_ActiveDirectory_SCP (Procedure)
sp_adddistributiondb (Procedure)
sp_addmergepublication (Procedure)
sp_addsynctriggers (Procedure)
sp_add_file_recover_suspect_db (Procedure)
sp_add_maintenance_plan_db (Procedure)
sp_attachsubscription (Procedure)
sp_certify_removable (Procedure)
sp_changedistpublisher (Procedure)
sp_changedistributiondb (Procedure)
sp_changemergearticle (Procedure)
sp_changereplicationserverpasswords (Procedure)
sp_check_for_owned_jobsteps (Procedure)
sp_check_removable_sysusers (Procedure)
sp_copysubscription (Procedure)
sp_create_removable (Procedure)
sp_dbcmptlevel (Procedure)
sp_dboption (Procedure)
sp_dbremove (Procedure)
sp_db_vardecimal_storage_format (Procedure)
sp_detach_db (Procedure)
sp_dropdistpublisher (Procedure)
sp_dropdistributiondb (Procedure)
sp_dropdistributor (Procedure)
sp_dropmergepullsubscription (Procedure)
sp_dropmergesubscription (Procedure)
sp_expired_subscription_cleanup (Procedure)
sp_fulltext_database (Procedure)
sp_get_distributor (Procedure)
sp_get_Oracle_publisher_metadata (Procedure)
sp_helparticledts (Procedure)
sp_helpdb (Procedure)
sp_helpdistributiondb (Procedure)
sp_helplogins (Procedure)
sp_helpreplicationdb (Procedure)
sp_instdist (Procedure)
sp_makewebtask (Procedure)
sp_mergearticlecolumn (Procedure)
sp_mergesubscription_cleanup (Procedure)
sp_MSadd_repl_commands27hp (Procedure)
sp_MSarticle_validation (Procedure)
sp_MSCheckmergereplication (Procedure)
sp_MScheckvalidsystables (Procedure)
sp_MScleanupmergepublisher_internal (Procedure)
sp_MScleanup_publication_ADinfo (Procedure)
sp_MSdbuseraccess (Procedure)
sp_MSdrop_6x_replication_agent (Procedure)
sp_MSenumallpublications (Procedure)
sp_MSenumallsubscriptions (Procedure)
sp_MSenumthirdpartypublicationvendornames (Procedure)
sp_MSenum_replication_agents (Procedure)
sp_MSenum_replqueues (Procedure)
sp_MSenum_replsqlqueues (Procedure)
sp_MSforeachdb (Procedure)
sp_MSget_last_transaction (Procedure)
sp_MShasdbaccess (Procedure)
sp_MShelpobjectpublications (Procedure)
sp_MShelp_replication_status (Procedure)
sp_MSload_tmp_replication_status (Procedure)
sp_MSmergepublishdb (Procedure)
sp_MSpublication_validation (Procedure)
sp_MSpublishdb (Procedure)
sp_MSremovedbreplication (Procedure)
sp_MSremovedbreplication_internal (Procedure)
sp_MSreplcheck_pull (Procedure)
sp_MSreplicationcompatlevel (Procedure)
sp_MSrepl_addpublication (Procedure)
sp_MSrepl_addpublication_snapshot (Procedure)
sp_MSrepl_articlecolumn (Procedure)
sp_MSrepl_backup_complete (Procedure)
sp_MSrepl_backup_start (Procedure)
sp_MSrepl_clean_replication_bit (Procedure)
sp_MSrepl_DistributorPALAccess (Procedure)
sp_MSrepl_DistributorReplMonitorAccess (Procedure)
sp_MSrepl_dropsubscriber (Procedure)
sp_MSrepl_drop_expired_sub_cleanup_job (Procedure)
sp_MSrepl_enumpublications (Procedure)
sp_MSrepl_enumsubscriptions (Procedure)
sp_MSrepl_helparticle (Procedure)
sp_MSrepl_helppublication (Procedure)
sp_MSrestoredbreplication (Procedure)
sp_MSretrieve_publication_attributes (Procedure)
sp_MSscriptdatabase (Procedure)
sp_refreshreplsysservers (Procedure)
sp_removesrvreplication (Procedure)
sp_renamedb (Procedure)
sp_replicationdboption (Procedure)
sp_replrestart (Procedure)
sp_resetstatus (Procedure)
sp_sqlagent_get_startup_info (Procedure)
sp_sysdac_add_instance (Procedure)
sp_sysdac_resolve_pending_entry (Procedure)
sp_sysutility_ucp_initialize (Procedure)
sp_sysutility_ucp_initialize_mdw (Procedure)
sp_sysutility_ucp_provision_proxy_account (Procedure)
sp_updatestats (Procedure)
sp_vupgrade_express_edition (Procedure)
sp_vupgrade_heterogeneous_publishers (Procedure)
sp_vupgrade_mergetables (Procedure)
sp_vupgrade_publisher (Procedure)
sp_vupgrade_publisherdb (Procedure)
sp_vupgrade_registry (Procedure)
sp_vupgrade_replication (Procedure)
sp_vupgrade_replsecurity_metadata (Procedure)
sp_vupgrade_subpass (Procedure)
sp_vupgrade_subscription_databases (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash