Sergey,
Thanks to the code. I'm in the process of proving that VFP is the best tool to develop a "heads down" back office business application for my company. I have been given an opportunity to prototype what my co-workers call a "4GL" (we'd call it a framework) for them to use and every trick I can come up with to simplify things will make the sales job easier.
Gary
>The code below will return the list of index names with specified column in it. you can adapt it to your needs.
IF object_id('tempdb..#mytable') IS NOT NULL
> DROP TABLE #mytable
>DECLARE @table varchar(128), @column varchar(128)
>SET @table = 'authors'
>SET @column = 'au_id'
>USE pubs
>CREATE TABLE #mytable (
> index_name sysname,
> index_description varchar(210),
> index_keys nvarchar(2078) )
>INSERT #mytable EXEC sp_helpindex authors
>SELECT index_name FROM #mytable
> WHERE ' ' + index_keys + ',' LIKE '% ' + @column + ',%'
>IF object_id('tempdb..#mytable') IS NOT NULL
> DROP TABLE #mytable
>
>
>>Does anyone know how to determine if a field from a SQL Server table is part of an index on that table? I want to know in order to prevent a possible LONG query that's not using an indexed field. I have been studying the system tables, but can't seem to figure it out how to determine that fact. Thanks
>>
>>Gary