SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software Kodyaz SQL Server and T-SQL Development Tutorials
Development resources, articles, tutorials, samples, codes and tools for .Net, SQL Server, Windows, Windows Phone, SAP and ABAP, like SAP UI5, Screen Personas, etc.




download SQL Server 2016
download SQL Server 2014

sysindexes System View - List of Indexes Defined on a SQL Database Table


SQL developers and SQL Server database administrators frequently require to list of indexes defined on a sql database table.
Any in many cases list indexes and fields of indexes defined on a sql table are necessary for building generic database applications for sql developers.

In MS SQL Server 2005 and later versions (SQL Server 2008, SQL Server 2008 R2), t-sql developers and sql administrators can use below t-sql select script in order to list SQL Server indexes defined for a sql table.
The given t-sql sample runs a SELECT statement on sys.indexes table (in fact sys.indexes system view) with Object_Id of the sql table is in the WHERE criteria.

SELECT
  object_id,
  name,
  index_id,
  type,
  type_desc,
  is_unique,
  data_space_id,
  ignore_dup_key,
  is_primary_key,
  is_unique_constraint,
  fill_factor,
  is_padded,
  is_disabled,
  is_hypothetical,
  allow_row_locks,
  allow_page_locks,
  has_filter,
  filter_definition
FROM sys.indexes
WHERE
  object_id = object_id('HumanResources.Employee')




Here is the sample output of the tsql select statement on sysindexes table (or sys.indexes system view).

sql-server-sysindexes-system-view-for-index-on-table






Related SQL Resources

SQL Server Articles

SQL Server 2012

SQL Server Tools

SQL Blog

MS SQL Server Forums









Copyright © 2004 - 2017 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems