Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sysindexes

  No additional text.


Syntax
CREATE VIEW sys.sysindexes AS
	SELECT id,
		status = convert(int,
			case indid when 1 then 16 else 0 end	-- (is_clustered * 16)
			+ (status & 8)/4		-- IS_IND_UNIQUE (is_unique * 2)
			+ (status & 4)/4		-- IS_IND_DPKEYS (ignore_dup_key * 1)
			+ (status & 32)*64	-- IS_IND_PRIMARY (is_primary_key * 2048)
			+ (status & 64)*64	-- IS_IND_UNIQUE_CO (is_unique_constraint * 4096)
			+ (status & 16)*16	-- IS_IND_PADINDEX (is_padded * 256)
			+ (status & 256)/8		-- IS_IND_ITWINDEX (is_hypothetical * 32)
			+ (1-(status & 1))*64	-- IS_INDEX
			+ (status & 8192)*1024	-- IS_STATS_AUTO_CRT (auto_created * 0x800000)
			+ (status & 16384)*1024),	-- IS_STATS_NORECOMP (no_recompute * 0x1000000)
		first = case when i.rowset > 0 then p.first end,
		indid = convert(smallint, indid),
		root = case when i.rowset > 0 then p.root end,
		minlen = convert(smallint, case when status & 1 = 0 then 0 else indexproperty(id, name, 'minlen') end),
		keycnt = convert(smallint, indexproperty(id, name, 'keycnt80')),
		groupid = convert(smallint, case when dataspace < 32768 then dataspace end),
		dpages = convert(int, case when status & 1 = 0 then 0 else p.data_pages end),
		reserved = convert(int, case when status & 1 = 0 then 0 else p.total_pages end),
		used = convert(int, case when status & 1 = 0 then 0 else p.used_pages end),
		rowcnt = convert(bigint, case when status & 1 = 0 then 0 else p.rows end),
		rowmodctr = convert(int, indexproperty(id, name, 'rowmodcnt80')),
		reserved3 = convert(tinyint, 0),
		reserved4 = convert(tinyint, 0),
		xmaxlen = convert(smallint, case when status & 1 = 0 then 0 else indexproperty(id, name, 'maxlen') end),
		p.maxirow,
		OrigFillFactor = convert(tinyint, (status & 1)*fillfact),	-- fill_factor
		StatVersion = convert(tinyint, 0),
		reserved2 = convert(int, 0),
		FirstIAM = case when i.rowset > 0 then p.FirstIAM end,
		impid = convert(smallint, 0),
		lockflags = convert(smallint, (status & 512)/512 + (status & 1024)/512),	-- no_row_locks + no_page_locks*2
		pgmodctr = convert(int, 0),
		keys = convert(varbinary(1088), null),
		name = name,
		statblob = convert (image, null),
		maxlen = convert(int, 8000),
		rows = convert(int,  case when status & 1 = 0 then 0 else 0x7FFFFFFF & p.rows end)
	FROM sys.sysidxstats i OUTER APPLY OpenRowset(TABLE INDEXPROP, id, indid, rowset) p
	WHERE indid < 256000
		AND has_access('CO', id) = 1

 
Last revision 2008RTM
See also

  sp_dbcmptlevel (Procedure)
sp_getarticlepkcolbitmap (Procedure)
sp_getqueuedrows (Procedure)
sp_ivindexhasnullcols (Procedure)
sp_mergearticlecolumn (Procedure)
sp_MSarticle_validation (Procedure)
sp_MSbuild_single_post (Procedure)
sp_MScreate_common_dist_tables (Procedure)
sp_MScreate_dist_tables (Procedure)
sp_MScreate_sub_tables_internal (Procedure)
sp_MSestimatemergesnapshotworkload (Procedure)
sp_MSestimatesnapshotworkload (Procedure)
sp_MShelpcolumns (Procedure)
sp_MShelpfulltextindex (Procedure)
sp_MShelpfulltextscript (Procedure)
sp_MShelpindex (Procedure)
sp_MSindexspace (Procedure)
sp_MSisallreplcolpk (Procedure)
sp_MSisnonpkukupdateinconflict (Procedure)
sp_MSispkupdateinconflict (Procedure)
sp_MSmakeconflicttable (Procedure)
sp_MSmatchkey (Procedure)
sp_MSmerge_metadataupgrade (Procedure)
sp_MSmerge_subscriptions_upgrade (Procedure)
sp_MSpublication_validation (Procedure)
sp_MSreplsup_table_has_pk (Procedure)
sp_MSrepl_addarticle (Procedure)
sp_MSrepl_articlecolumn (Procedure)
sp_MStablekeys (Procedure)
sp_MStablerefs (Procedure)
sp_MStablespace (Procedure)
sp_MStable_has_unique_index (Procedure)
sp_MStable_validation (Procedure)
sp_MSUpgradeConflictTable (Procedure)
sp_repldropcolumn (Procedure)
sp_repltablehasnonpkuniquekey (Procedure)
sp_table_validation (Procedure)
sp_updatestats (Procedure)
sp_vupgrade_distdb (Procedure)
sp_vupgrade_mergetables (Procedure)
sp_vupgrade_MSsubscription_properties (Procedure)
sp_vupgrade_publisherdb (Procedure)
sp_vupgrade_replmsdb (Procedure)
sp_vupgrade_subscription_tables (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