我有一个奇怪的问题,我的游戏有一个触发器。
我收到以下错误,但看不到问题所在。
“ 2019-03-13 14:30:01 err = -1,[Microsoft] [ODBC SQL Server驱动程序] [SQL Server] 子查询返回了多个值。 {{1} },当子查询遵循=,!=,<,<=,>,> =或将子查询用作表达式时。SQL状态:21000,本地错误:512(0x200)
2019-03-13 14:30:01 :: SaveCharacter 1144 Lexii ret = 1,qerr = -1,{?=致电Usp_Save_Char_Quest_Add_E(1144,2222,0,0,0,0)}“
This is not permitted
答案 0 :(得分:0)
试试看!希望这能解决您的问题。
DECLARE @QuestID INT = (SELECT QuestID FROM inserted)
IF @QuestID = 2222 -- The Perfect Orange Stats QuestID
BEGIN
DECLARE @CharID INT = (SELECT CharID FROM inserted)
DECLARE @UserUID INT = (SELECT TOP 1 UserUID FROM Chars WHERE CharID = @CharID)
答案 1 :(得分:0)
这个问题只发生在某些玩家身上,似乎这个存储过程是错误的
USE [PS_GameData]
GO
/****** Object: StoredProcedure [dbo].[usp_Save_Char_Quest_Add_E] Script Date: 13/03/2019 18:02:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Proc [dbo].[usp_Save_Char_Quest_Add_E]
@CharID int,
@QuestID int,
@Delay smallint = Null,
@Count1 tinyint = Null,
@Count2 tinyint = Null,
@Count3 tinyint = Null
AS
SET NOCOUNT ON
INSERT INTO CharQuests(CharID,QuestID,[Delay],Count1,Count2,Count3) VALUES(@CharID,@QuestID,@Delay,@Count1,@Count2,@Count3)
IF(@@ERROR = 0)
BEGIN
RETURN 1
END
ELSE
BEGIN
RETURN -1
END
SET NOCOUNT OFF