April 26, 2011 at 9:46 am
I have run across using a WHERE clause in an index
and it works great.
but in the future if I have forgotten what the where clause
specified. how do I find out.
I have a looked in sysindexes and syscolumns
but don't see anything that would help me
any suggestions
Thanks
Mike Donnelly
April 26, 2011 at 9:54 am
Do you mean what columns are used in the index and what columns are in the INCLUDE clause of the index?
Also using sp_help on the table the index is created on will give you the columns used by the index.
MCITP SQL 2005, MCSA SQL 2012
April 26, 2011 at 9:59 am
Is this the filtered index introduced in SQL Server 2008? See if this rings any bells:
April 26, 2011 at 10:00 am
I am looking for
what the WHERE clause specified
right now I know I created the index like this
CREATE INDEX IDX_indexname
ON TABLE1(StoreID,ItemsProcessed)
WHERE ItemsProcessed = 0
but If in the future, I forget what the WHERE clause
specified, How do I find out
April 26, 2011 at 10:04 am
I don't have 2008 to test but that's the first thing I'd try.
sp_helpindex 'tblname'
If that fails I'd go to sys.indexes. It pretty much has to be in that table.
April 26, 2011 at 10:19 am
You want to look for the filter_definition column in sys.indexes.
April 26, 2011 at 10:23 am
It might be in other places, but I know that it is in sys.indexes. Specifically, the column filter_definition.
EDIT: Too slow..
April 26, 2011 at 10:29 am
I preffer to say that you started too late... I can't believe it took you 20 minutes to write that message :w00t:.
April 26, 2011 at 10:34 am
Thank you, I found it
I thought that sysindexes and sys.Indexes where the same thing
I only looked in sysindexes
Mike
April 26, 2011 at 10:36 am
dbo.sysindexes is pre 2005. It's there only for backward compatibility along with pretty much anything that was available in 2000 and before.
April 26, 2011 at 11:32 am
Ninja's_RGR'us (4/26/2011)
I preffer to say that you started too late... I can't believe it took you 20 minutes to write that message :w00t:.
I know.. pretty sad.. 😉
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply