Cannot index the view '...'. It contains one or more disallowed constructs.

  • My View is like this

    CREATE VIEW dbo.V_CODE_SUBCODES

    WITH SCHEMABINDING

    AS

    SELECT TOP 100 PERCENT W.CODE, S.BIN, COUNT_BIG (W.CODE) AS QTY

    FROM dbo.T_WAFER_SUBCODES S INNER JOIN

    dbo.T_WAFERS W ON S.WAFER = W.WAFER

    GROUP BY W.CODE, S.BIN

    and was trying to create an index

    CREATE UNIQUE CLUSTERED

    INDEX [IX_V_CODE_SUBCODES] ON [dbo].[V_CODE_SUBCODES] (, [BIN])

    And I get the error.

    Msg 1936, Level 16, State 1, Line 1

    Cannot index the view 'PRODENG.dbo.V_CODE_SUBCODES'. It contains one or more disallowed constructs.

    Since I'm using an inner join, I thought it would be ok.

    Thanks

    Martin

  • There's no problem with the INNER JOIN, it's the TOP 100 PERCENT that it's complaining about.

    Why do you need the TOP 100 PERCENT?

  • The only time I have ever needed "top 100 percent" is when I wanted an "order by" in the view.

    I don't believe you need it in this case.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • I sooo missed that, I built the origional query with an order by in the EM, and it automatically puts that statement in...

    Awsome, worked a treat. It's a shame that the error message wasn't a bit more helpfull.

    Thanks guys.

    Martin

Viewing 4 posts - 1 through 3 (of 3 total)

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