usp_auditRejectRequest:收到錯誤:無法將NULL值插入列 'ENTRYID'
CREATE PROCEDURE [a01].[usp_auditRejectRequest]
(@accountID UNIQUEIDENTIFIER , @GroupID UNIQUEIDENTIFIER)
AS
BEGIN
INSERT INTO [a01].[tbl_enrollmentAudits]
(entryID,entryDate, requestID, accountID, groupID, accepted, reason)
VALUES(NULL,SYSDATETIMEOFFSET(), NULL, @accountID, @GroupID, 0, NULL);
END
GO
usp_auditAcceptRequest:
CREATE PROCEDURE [a01].[usp_auditAcceptRequest]
(@accountID UNIQUEIDENTIFIER , @GroupID UNIQUEIDENTIFIER)
AS
BEGIN
INSERT INTO [a01].[tbl_enrollmentAudits]
(entryID,entryDate, requestID, accountID, groupID, accepted, reason)
VALUES(NULL,SYSDATETIMEOFFSET(), NULL, @accountID, @GroupID, 1, NULL);
END
GO
usp_addRequest:
CREATE PROCEDURE [a01].[usp_addRequest]
(@AccountID UNIQUEIDENTIFIER, @GroupID UNIQUEIDENTIFIER)
AS
BEGIN
SET NOCOUNT ON
IF ([a01].[udf_isUserActive](@AccountID) = 0)
BEGIN
EXECUTE [a01].[usp_auditRejectRequest]
@AccountID, @GroupID
RETURN;
END;
IF ([a01].[udf_isUserBlockedFromGroup](@GroupID)=0)
BEGIN
EXECUTE [a01].[usp_auditRejectRequest]
@AccountID, @GroupID
RETURN;
END;
END;
GO
輸出:加不活動的用戶:
BEGIN
DECLARE @AccountID UNIQUEIDENTIFIER;
DECLARE @GroupID UNIQUEIDENTIFIER;
(SELECT @AccountID = accountID
FROM [a01].[tbl_userAccounts] WHERE accountUsername='adrianab');
(SELECT @GroupID = groupID FROM [a01].[tbl_groups] WHERE groupName LIKE '%Foo%');
EXECUTE [a01].[usp_addRequest] @AccountID, @GroupID;
END;
GO
我不能再聲明任何更多UNIQUE IDENTIFIEd,accountId和groupID是唯一可以按照我們講師的指示使用的。
的[過程或函數可能的複製! !有太多的參數指定](http://stackoverflow.com/questions/17292705/procedure-or-function-has-too-many-arguments-specified) – VikingBlooded
當我使用2個參數,另一個錯誤信息顯示「a null值不能被插入到entryID中「。 AS entryID是我猜的PK!錯誤信息:「無法將值NULL插入到列'entryID',表tbl_enrollmentAudits';列不允許爲空值INSERT失敗 – NOSMILE
回答原始問題時,請不要將問題更改爲新問題。到第一個問題,所以這將是沒有意義的,除非有人通過編輯歷史 – Paparazzi