Creating a Filtered non Clustered Index ...

  • Could someone please point out where I have the syntax error and how can I fix it???

    USE Sandbox

    GO

    CREATE NONCLUSTERED INDEX [idx_FilterTest] ON dbo.TestTable

    ( col1, col2, col3 )

    INCLUDE

    ( col4, col5 )

    WHERE ([MyDate] > '2010-09-23 00:00:00.000' )

    WITH (

    PAD_INDEX = ON, STATISTICS_NORECOMPUTE = OFF,

    SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = ON,

    ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON,

    FILLFACTOR = 92)

    ON NCIndexes

    GO

    Gives me this error:

    Msg 156, Level 15, State 1, Line 14

    Incorrect syntax near the keyword 'WHERE'.

    "Where" the heck do I put the WHERE condition??? I looked it up at http://technet.microsoft.com/en-us/library/cc280372.aspx and it seems pretty straigh forward. The only difference I see is in the examples they never include the WITH(x,y,z) or specify which file group the index will get created on (which is something I want)

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience

  • Nevermind...found the issue. Apparently it doesn't worky well on SQL 2005, runs great on 2008!!!

    :pinch:

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply