mhamdani049

AKI-REFILL-9

Jun 29th, 2020
1,411
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. USE SPEX_DB;
  2.  
  3. IF EXISTS (
  4. SELECT *
  5.     FROM INFORMATION_SCHEMA.ROUTINES
  6. WHERE SPECIFIC_SCHEMA = N'spex'
  7.     AND SPECIFIC_NAME = N'SP_AMANAH_RE_FILL_5_CLOSE_BT'
  8.     AND ROUTINE_TYPE = N'PROCEDURE'
  9. )
  10. DROP PROCEDURE spex.SP_AMANAH_RE_FILL_5_CLOSE_BT
  11. GO
  12.  
  13. CREATE PROCEDURE spex.SP_AMANAH_RE_FILL_5_CLOSE_BT
  14. (
  15.     @RESERVE_LOC VARCHAR(MAX),
  16.     @BT_NO VARCHAR(30),
  17.     @USERNAME VARCHAR(20)
  18. )
  19. AS
  20. BEGIN
  21.  
  22.     DECLARE @MSG_TEXT VARCHAR(MAX) = ''
  23.     DECLARE @RES_TEXT VARCHAR(MAX) = ''
  24.  
  25.     SET NOCOUNT ON;
  26.     CREATE TABLE #TB_T_DATA (
  27.         RESULT VARCHAR(MAX),
  28.         Message VARCHAR(MAX)
  29.     )
  30.  
  31.     DELETE FROM TB_T_BUCKET_TRANSFER
  32.     WHERE BT_NO = @BT_NO
  33.  
  34.     -- UPDATE dbo.TB_R_REFILL SET STATUS = 0 WHERE TRANSFER_NO = @TRANSFER_NO AND BT_NO = @BT_NO
  35.  
  36.     SET @MSG_TEXT = '';
  37.     SET @RES_TEXT = 'Success'
  38.  
  39.     INSERT INTO #TB_T_DATA
  40.     VALUES (@RES_TEXT, @MSG_TEXT)
  41.  
  42.     SELECT RESULT, Message
  43.     FROM #TB_T_DATA
  44.  
  45. END
  46. GO
RAW Paste Data