首页 新闻 赞助 找找看

MSSQL在视图上创建索引的问题

0
悬赏园豆:20 [已解决问题] 解决于 2016-08-30 17:11

创建视图索引报错:

1 create unique clustered index index_ProductList_ShopID on VIEW_Gm_InventoryBalance_ProductList(lngProductID)

消息 10138,级别 16,状态 1,第 1 行
无法对视图 'GMdata.dbo.VIEW_Gm_InventoryBalance_ProductList' 创建 索引,因为其选择列表对 COUNT_BIG 的使用方法不正确。请考虑在选择列表中添加 COUNT_BIG(*)。

 

下面帖视图代码:

 

 1 ALTER VIEW  [dbo].[VIEW_Gm_InventoryBalance_ProductList] 
 2 with schemabinding
 3 AS
 4 
 5 SELECT 
 6 a.lngShopID,a.lngProductTypeID, 
 7 a.strProductTypeName, a.lngProductID, 
 8 a.lngBrandID,b.strBrandName,
 9 a.strPeriod,a.dblBeginQty,a.dblInQty,a.dblOutQty,a.dblEndQty
10 
11 ,case when a.lngProductModelID is null then 0 else lngProductModelID end lngProductModelID,
12 case when a.strModel is null then '' else strModel end strModel ,
13 case when a.strBelongingsNo is null then '' else strBelongingsNo end strBelongingsNo
14 
15 FROM dbo.Gm_InventoryBalance a
16 inner join dbo.Gm_Brand b on a.lngBrandID=b.lngBrandID
17 GROUP BY a.lngShopID,  
18 a.lngProductTypeID, 
19 a.strProductTypeName, a.lngProductID, 
20 a.lngBrandID, b.strBrandName,
21 a.lngProductModelID, a.strModel, 
22 a.strBelongingsNo,a.strPeriod,a.dblBeginQty,a.dblInQty,a.dblOutQty,a.dblEndQty
23 
24 
25 GO
View Code

 

不知道为什么会出现这样的问题,求解答。

二月二十号的主页 二月二十号 | 初学一级 | 园豆:38
提问于:2016-08-10 10:43
< >
分享
最佳答案
0
收获园豆:20
CodeHsu | 大侠五级 |园豆:5468 | 2016-08-10 13:55
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册