日期:2014-05-17 浏览次数:20364 次
CREATE PROCEDURE dbo.PopTable2
@r_FileId CHAR(10) = NULL OUTPUT,
@r_FileOriginalPriority TINYINT = NULL OUTPUT,
@r_Status TINYINT = NULL OUTPUT,
@r_LastUpdate SMALLDATETIME = NULL OUTPUT
AS
SET NOCOUNT ON
;WITH cte AS
(
SELECT TOP(1) * FROM dbo.Table2
WHERE Status = 1
ORDER BY FileOriginalPriority DESC ,LastUpdate ASC
)
UPDATE cte
SET @r_FileId = FileId,
@r_FileOriginalPriority = FileOriginalPriority,
@r_Status = Status,
@r_LastUpdate = LastUpdate,
Status = 12,
LastUpdate = GETDATE()
RETURN @@ERROR
GO
--等到13:10:00
waitfor time '13:10:00'
declare @r_FileId CHAR(10)
declare @r_FileOriginalPriority TINYINT
declare @r_Status