3
我曾嘗試使用下面的代碼錯誤添加索引到
CREATE VIEW dbo.two_weeks_performance WITH SCHEMABINDING
AS
SELECT dbo.day_dim.date_time AS Date,
dbo.order_dim.quantity AS Target_Acheived
FROM dbo.day_dim
JOIN dbo.order_fact ON dbo.day_dim.day_id = dbo.order_fact.day_id
JOIN dbo.branch_dim ON dbo.order_fact.branch_id = dbo.branch_dim.branch_id
JOIN dbo.order_dim ON dbo.order_fact.order_id = dbo.order_dim.order_id
GROUP BY dbo.order_dim.quantity, dbo.day_dim.date_time`
現在創建視圖時,我使用了一個觀點:
CREATE UNIQUE CLUSTERED INDEX two_weeks_performance_I ON two_weeks_performance (Date)
我得到一個錯誤:
Cannot create index because its select list does not use the correct usage of COUNT_BIG(). Consider adding COUNT_BIG(*) to the select.
請幫我解決這個問題。
感謝這...這是有用的! – Deepak 2010-11-17 09:20:12