RE: How to know a column whether indexed or not in sql2k by NoSpamMgbworld

NoSpamMgbworld
Wed Oct 26 07:37:04 CDT 2005

First, it is not wise to only have a subject, as your question can get cut
off and, therefore, never answered. Best to put the question in the body,
even if it is a repeat.

To find columns, you use the system tables (or Sys views: SQL Server 2005).
I do not have a query for this, however. The SQL Server Programming group is
the best shot for this; Aaron Bertrand's ASPFAQ.com site may have an answer,
as well (Aaron is a SQL Server MVP).

In a more generic way, you can use SQL-DMO, but this involves interop with
.NET. There is also an ADO library (ADOX, I believe) that will work against
multiple types of databases; it is also Interop.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************


"joy.net" wrote:

>
>
>

Re: How to know a column whether indexed or not in sql2k by Mark

Mark
Wed Oct 26 07:55:24 CDT 2005

"joy.net" <luxingyu1@hotmail.com> wrote in message
news:eLcz8Pd2FHA.2440@TK2MSFTNGP10.phx.gbl...

1) Use the system stored procedure sp_help and pass it the name of the table
which contains the column that you're interested in.

2) Look for the column name in the index_keys column of the sixth
resultset - if it's there, the column participates in a least one index.



Re: How to know a column whether indexed or not in sql2k by William

William
Wed Oct 26 12:39:06 CDT 2005

Or use the new 2.0 GetSchema method on the Connection.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Cowboy (Gregory A. Beamer) - MVP" <NoSpamMgbworld@comcast.netNoSpamM> wrote
in message news:E9D7FD45-3933-4515-BE9F-A2CCF4D9D1CD@microsoft.com...
> First, it is not wise to only have a subject, as your question can get cut
> off and, therefore, never answered. Best to put the question in the body,
> even if it is a repeat.
>
> To find columns, you use the system tables (or Sys views: SQL Server
> 2005).
> I do not have a query for this, however. The SQL Server Programming group
> is
> the best shot for this; Aaron Bertrand's ASPFAQ.com site may have an
> answer,
> as well (Aaron is a SQL Server MVP).
>
> In a more generic way, you can use SQL-DMO, but this involves interop with
> .NET. There is also an ADO library (ADOX, I believe) that will work
> against
> multiple types of databases; it is also Interop.
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
>
> ***************************
> Think Outside the Box!
> ***************************
>
>
> "joy.net" wrote:
>
>>
>>
>>