all groups > sql server programming > february 2005 >
You're in the

sql server programming

group:

Syntax for Index


Syntax for Index Ed
2/12/2005 5:45:01 PM
sql server programming:
hi,
Is that possible I can use Information_Schema to find out all the index
name(s) in the table???
So far I have looked at all Information_Schema, but no luck and I have to
use sp_helpindex.

Thanks for any help

Re: Syntax for Index Robbe Morris
2/12/2005 9:45:07 PM
Take a look at some of the queries used in this .NET
sample.

http://www.eggheadcafe.com/articles/20020322.asp

--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.mastervb.net/home/ng/forumvbcode/post10017013.aspx




[quoted text, click to view]

Re: Syntax for Index Louis Davidson
2/12/2005 11:35:23 PM
Nope. Indexes are not part of the information_schema. What do you mean by
"index names in the table"? Do you mean all indexes on a table:


select name as index_name,
index_col(object_name(id), indid, 1) as column1,
index_col(object_name(id), indid, 2) as column2 --and so on
from sysindexes
where id = object_id('client_dim')
and indid <> 0 --if there is no clustered index, the heap shows up here.

look up INDEXPROPERTY for ways to eliminate other indexes.

--
----------------------------------------------------------------------------
Louis Davidson - drsql@hotmail.com
SQL Server MVP

Compass Technology Management - www.compass.net
Pro SQL Server 2000 Database Design -
http://www.apress.com/book/bookDisplay.html?bID=266
Blog - http://spaces.msn.com/members/drsql/
Note: Please reply to the newsgroups only unless you are interested in
consulting services. All other replies may be ignored :)
[quoted text, click to view]

Re: Syntax for Index Uri Dimant
2/13/2005 7:23:18 AM
Ed
Add to Louis's script
AND INDEXPROPERTY(id, name, 'IsStatistics') = 0 AND
INDEXPROPERTY(id,name, 'IsHypothetical') = 0


[quoted text, click to view]

AddThis Social Bookmark Button