我正在尝试制作存储过程,但是我收到此错误'错误的语法接近删除期望选择或'(''
CREATE PROCEDURE NSP166_DeleteDMSPermission
@PermissionID uniqueidentifier ,
@FunctionalDetailsId uniqueidentifier
AS
BEGIN
if(SELECT count(PermissionID) AS counts FROM NSP166_RolePermissionTrans where PermissionID=@PermissionID)>1
(
delete from NSP166_RolePermissionTrans where FunctionalDetailsId=@FunctionalDetailsId
)END
答案 0 :(得分:3)
if
的语法不使用括号。
CREATE PROCEDURE NSP166_DeleteDMSPermission
@PermissionID uniqueidentifier ,
@FunctionalDetailsId uniqueidentifier
AS
BEGIN
if (SELECT count(PermissionID) AS counts
FROM NSP166_RolePermissionTrans
where PermissionID=@PermissionID) > 1
begin
delete from NSP166_RolePermissionTrans
where FunctionalDetailsId=@FunctionalDetailsId
end
end;