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
Development resources, articles, tutorials, code samples, tools and downloads for ASP.Net, SQL Server, Reporting Services, T-SQL, Windows, AWS, SAP HANA and ABAP

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')
Code




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



SQL Server

SQL Server 2019 Installation
download SQL Server 2019
download SQL Server 2017
download SQL Server 2016
download SQL Server 2014
download SQL Server 2012
MacOS ve SQL Server 2019


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.