Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: SQL
Expertise: Beginner
Aug 23, 2005



Application Security Testing: An Integral Part of DevOps

Retrieve All the Index Names for a Given Table Using SQL Query

Use this code to retrieve all the Index names for a given table Using SQL query:

declare @tblName varchar(50);
set @tblName = 'GivenTable';
SELECT     o.name as TableName, i.name AS IndexName
FROM         sysobjects o, sysindexes i
WHERE   (o.id = i.id and o.name = @tblName) AND (i.status = 18450 OR   i.status = 2097152)
i.status = 18450 indicates a clustered index (or, primary key index) in the given table. i.status = 2097152 indicates a non-clustered index in the given table.

Note: @tblName is input parameter to the query. This query is applicable for MS SQL Server 2000.

Jaya Nehru Kumar
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date