2013-08-17 37 views
1

我試圖做一個存儲過程,但我得到這個錯誤「不正確的語法近刪除期望選擇或‘(’」附近有語法錯誤刪除期望選擇或「(」

CREATE PROCEDURE NSP166_DeleteDMSPermission 
@PermissionID uniqueidentifier , 
@FunctionalDetailsId uniqueidentifier 
AS 
BEGIN 

if(SELECT count(PermissionID) AS counts FROM NSP166_RolePermissionTrans where [email protected])>1 
(
delete from NSP166_RolePermissionTrans where [email protected] 
)END 

回答

3

的語法if不使用小括號。

CREATE PROCEDURE NSP166_DeleteDMSPermission 
@PermissionID uniqueidentifier , 
@FunctionalDetailsId uniqueidentifier 
AS 
BEGIN 
    if (SELECT count(PermissionID) AS counts 
     FROM NSP166_RolePermissionTrans 
     where [email protected]) > 1 
    begin 
     delete from NSP166_RolePermissionTrans 
      where [email protected] 
    end 
end; 
+0

謝謝你的工作.. – Such