Problem:
I Tried to Create a Index on the Existing View, then i got the following Error:
Msg 10138, Level 16, State 1, Line 1
Cannot create index on view 'EISA.dbo.VIEW_CLIENT_GLOBAL' because its select list does not include a proper use of COUNT_BIG. Consider adding COUNT_BIG(*) to select list.
Code1:
I Created View By using following Query:
Code2:
I Used the Following Query to Create an Index on the Created View "VIEW_CLIENT_GLOBAL" By using following Query:
Solution:
If you want to create a Index on the view, we need follow the rules given in the following link,
If GROUP BY is specified, the view select list must contain a COUNT_BIG(*) expression, and the view definition cannot specify HAVING, CUBE, or ROLLUP.
I Altered My View with COUNT_BIG(*) AS COUNT as shown below:
Then i created the index on the view by Query which is available in "Code2" Section, it works fine.
No comments:
Post a Comment