group中的bit字段 合并问题
消息 102,级别 15,状态 1,过程 ups_SecurityRolePermission_GetByModuleOneID,第 12 行
'Select ' 附近有语法错误。
消息 156,级别 15,状态 1,过程 ups_SecurityRolePermission_GetByModuleOneID,第 26 行
关键字 'group ' 附近有语法错误。
ALTER PROCEDURE [dbo].[ups_SecurityRolePermission_GetByModuleOneID]
(
@ModuleOneID int
)
AS
select 0 RoleID,
AppID,
AppName,
case when sum(Convert(int,[Select]))> 0 then 1 else 0 [Select],
case when sum(Convert(int,[Insert]))> 0 then 1 else 0 [Insert],
case when sum(Convert(int,[Delete]))> 0 then 1 else 0 [Delete],
case when sum(Convert(int,[Update]))> 0 then 1 else 0 [Update],
case when sum(Convert(int,[Print]))> 0 then 1 else 0 [Print],
case when sum(Convert(int,[Export]))> 0 then 1 else 0 [Export]
from dbo.[SecurityRolePermission]
where AppID in (select AppID
from dbo.[SecurityApp]
where ModuleTwoID in (select ModuleTwoID
from dbo.[SecurityModuleTwo]
where ModuleOneID=@ModuleOneID
)
)
group by AppID,AppName
Select @@ROWCOUNT
------解决方案--------------------丟了End
case when sum(Convert(int,[Select]))> 0 then 1 else 0 [Select],
case when sum(Convert(int,[Insert]))> 0 then 1 else 0 [Insert],
case when sum(Convert(int,[Delete]))> 0 then 1 else 0 [Delete],
case when sum(Convert(int,[Update]))> 0 then 1 else 0 [Update],
case when sum(Convert(int,[Print]))> 0 then 1 else 0 [Print],
case when sum(Convert(int,[Export]))> 0 then 1 else 0 [Export]
改為
case when sum(Convert(int,[Select]))> 0 then 1 else 0 End [Select],
case when sum(Convert(int,[Insert]))> 0 then 1 else 0 End [Insert],
case when sum(Convert(int,[Delete]))> 0 then 1 else 0 End [Delete],
case when sum(Convert(int,[Update]))> 0 then 1 else 0 End [Update],
case when sum(Convert(int,[Print]))> 0 then 1 else 0 End [Print],
case when sum(Convert(int,[Export]))> 0 then 1 else 0 End [Export]
------解决方案--------------------少了end