728x90
SELECT TOP [얻으려는 행의수] * FROM [TABLE]
WHERE [PRIMARY KEY] NOT IN ( SELECT TOP [중간의 시작위치 - 1] [PRIMARY KEY]
                                                 FROM [TABLE] WHERE [조건] ORDER BY [PRIMARY KEY])
AND [조건] ORDER BY [PRIMARY KEY] 
728x90
UPDATE MATBUY_LIST SET
ReceiptDate = CASE @pStatusCHK
When 'S' Then @pOrderDate
ELSE ReceiptDate
End,
OrderDate = @pOrderDate ,
Mention1 = @pMention1 ,
StatusCHK = @pStatusCHK ,
SysUser = @pRegUser ,
SysDate = GETDATE()
WHERE BUYNO = @pBUYNO 

[출처] UPDATE 문 CASE|작성자 윈마스터

728x90
(Select PaperNum, DeptCD, EmployeeID
From DECIDE_APPR
Where EmployeeID = @pDeptCD
And ApplyCHK LIKE CASE @pStatusCHK
WHEN '0' THEN ''
ELSE RTRIM(@pStatusCHK) + '%'
END ) T2 

+ Recent posts