主题:存储过程
[em10]
CREATE PROCEDURE SP_SkimBugTime
@INT_BugID INT
AS
BEGIN
declare @INT_ID INT
SET @INT_ID = 2 --@INT_BugID
bl.TXT_LogContent,
--通过时间降序排列来查找满足条件的学号,再通过学号来获得名字
(SELECT NVC_RealName
FROM T_Members
WHERE VCR_MemberID = (SELECT TOP 1 T_BugLog.VCR_OperatorID
FROM T_BugLog,T_ActionType
WHERE T_BugLog.INT_BugID = @INT_ID and T_ActionType.INT_ActionID = 3
and T_ActionType.INT_ActionID = T_BugLog.INT_ActionID
ORDER BY T_BugLog.DAT_ActionTime desc)) AS NVC_LastEditName, --最后修改者
--通过时间降序排列来查找满足条件的时间
(SELECT TOP 1 T_BugLog.DAT_ActionTime
FROM T_BugLog,T_ActionType
WHERE T_BugLog.INT_BugID = @INT_ID and T_ActionType.INT_ActionID = 3
and T_ActionType.INT_ActionID = T_BugLog.INT_ActionID
ORDER BY T_BugLog.DAT_ActionTime desc) AS DAT_LastEditTime, --最后修改时间
--通过时间降序排列来查找满足条件的学号,再通过学号来获得名字
(SELECT NVC_RealName
FROM T_Members
WHERE VCR_MemberID = (SELECT TOP 1 T_BugLog.VCR_OperatorID
FROM T_BugLog,T_ActionType
WHERE T_BugLog.INT_BugID = @INT_ID and T_ActionType.INT_ActionID = 7
and T_ActionType.INT_ActionID = T_BugLog.INT_ActionID
ORDER BY T_BugLog.DAT_ActionTime desc)) AS NVC_SolveName, --解决者
--通过时间降序排列来查找满足条件的时间
(SELECT TOP 1 T_BugLog.DAT_ActionTime
FROM T_BugLog,T_ActionType
WHERE T_BugLog.INT_BugID = @INT_ID and T_ActionType.INT_ActionID = 7
and T_ActionType.INT_ActionID = T_BugLog.INT_ActionID
ORDER BY T_BugLog.DAT_ActionTime desc) AS DAT_SolveTime, --解决时间
--通过时间降序排列来查找满足条件的学号,再通过学号来获得名字
(SELECT NVC_RealName
FROM T_Members
WHERE VCR_MemberID = (SELECT TOP 1 T_BugLog.VCR_OperatorID
FROM T_BugLog,T_ActionType
WHERE T_BugLog.INT_BugID = @INT_ID and T_ActionType.INT_ActionID = 5
and T_ActionType.INT_ActionID = T_BugLog.INT_ActionID
ORDER BY T_BugLog.DAT_ActionTime desc)) AS NVC_CloseName, --关闭者
--通过时间降序排列来查找满足条件的时间
(SELECT TOP 1 T_BugLog.DAT_ActionTime
FROM T_BugLog,T_ActionType
WHERE T_BugLog.INT_BugID = @INT_ID and T_ActionType.INT_ActionID = 5
and T_ActionType.INT_ActionID = T_BugLog.INT_ActionID
ORDER BY T_BugLog.DAT_ActionTime desc) AS DAT_CloseTime, --关闭时间
FROM T_BugLog bl
inner join T_Members mb
on bl.VCR_OperatorID = mb.VCR_MemberID AND INT_BugID = @INT_ID
IF @@ERROR <> 0
RETURN 0
RETURN 1
END
GO
CREATE PROCEDURE SP_SkimBugTime
@INT_BugID INT
AS
BEGIN
declare @INT_ID INT
SET @INT_ID = 2 --@INT_BugID
bl.TXT_LogContent,
--通过时间降序排列来查找满足条件的学号,再通过学号来获得名字
(SELECT NVC_RealName
FROM T_Members
WHERE VCR_MemberID = (SELECT TOP 1 T_BugLog.VCR_OperatorID
FROM T_BugLog,T_ActionType
WHERE T_BugLog.INT_BugID = @INT_ID and T_ActionType.INT_ActionID = 3
and T_ActionType.INT_ActionID = T_BugLog.INT_ActionID
ORDER BY T_BugLog.DAT_ActionTime desc)) AS NVC_LastEditName, --最后修改者
--通过时间降序排列来查找满足条件的时间
(SELECT TOP 1 T_BugLog.DAT_ActionTime
FROM T_BugLog,T_ActionType
WHERE T_BugLog.INT_BugID = @INT_ID and T_ActionType.INT_ActionID = 3
and T_ActionType.INT_ActionID = T_BugLog.INT_ActionID
ORDER BY T_BugLog.DAT_ActionTime desc) AS DAT_LastEditTime, --最后修改时间
--通过时间降序排列来查找满足条件的学号,再通过学号来获得名字
(SELECT NVC_RealName
FROM T_Members
WHERE VCR_MemberID = (SELECT TOP 1 T_BugLog.VCR_OperatorID
FROM T_BugLog,T_ActionType
WHERE T_BugLog.INT_BugID = @INT_ID and T_ActionType.INT_ActionID = 7
and T_ActionType.INT_ActionID = T_BugLog.INT_ActionID
ORDER BY T_BugLog.DAT_ActionTime desc)) AS NVC_SolveName, --解决者
--通过时间降序排列来查找满足条件的时间
(SELECT TOP 1 T_BugLog.DAT_ActionTime
FROM T_BugLog,T_ActionType
WHERE T_BugLog.INT_BugID = @INT_ID and T_ActionType.INT_ActionID = 7
and T_ActionType.INT_ActionID = T_BugLog.INT_ActionID
ORDER BY T_BugLog.DAT_ActionTime desc) AS DAT_SolveTime, --解决时间
--通过时间降序排列来查找满足条件的学号,再通过学号来获得名字
(SELECT NVC_RealName
FROM T_Members
WHERE VCR_MemberID = (SELECT TOP 1 T_BugLog.VCR_OperatorID
FROM T_BugLog,T_ActionType
WHERE T_BugLog.INT_BugID = @INT_ID and T_ActionType.INT_ActionID = 5
and T_ActionType.INT_ActionID = T_BugLog.INT_ActionID
ORDER BY T_BugLog.DAT_ActionTime desc)) AS NVC_CloseName, --关闭者
--通过时间降序排列来查找满足条件的时间
(SELECT TOP 1 T_BugLog.DAT_ActionTime
FROM T_BugLog,T_ActionType
WHERE T_BugLog.INT_BugID = @INT_ID and T_ActionType.INT_ActionID = 5
and T_ActionType.INT_ActionID = T_BugLog.INT_ActionID
ORDER BY T_BugLog.DAT_ActionTime desc) AS DAT_CloseTime, --关闭时间
FROM T_BugLog bl
inner join T_Members mb
on bl.VCR_OperatorID = mb.VCR_MemberID AND INT_BugID = @INT_ID
IF @@ERROR <> 0
RETURN 0
RETURN 1
END
GO