• you have to update statistics on all tables with full scan after a version upgrade, or restore of a database from a lower version to a higher;

    the statistics are treated differently and the new optimizer needs them to be updated.

    a quick script like this can help:

    DECLARE @Exec VARCHAR(MAX)

    SELECT @Exec = ''

    SELECT @Exec = 'UPDATE STATISTICS '

    + QUOTENAME(schema_name(schema_id))

    + '.'

    + quotename(name)

    + ' WITH FULLSCAN ; '

    + CHAR(13) + CHAR(10)

    + @Exec

    FROM sys.tables ORDER BY name DESC

    PRINT LEN(@Exec)

    PRINT @Exec

    EXEC(@Exec)

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!