Advertisement
Guest User

Untitled

a guest
May 27th, 2016
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.17 KB | None | 0 0
  1. USE [SRO_VT_CUSTOM]
  2. GO
  3. /****** Object:  StoredProcedure [dbo].[sys_FreeStorageSlots]    Script Date: 5/27/2016 11:31:51 AM ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8.  
  9. CREATE PROCEDURE [dbo].[sys_FreeStorageSlots]
  10. -- =============================================
  11. -- Author:      <tschulian>
  12. -- Create date:     <27.05.2016>
  13. -- Description:     <Returns the free Storage Slots of the selected User>
  14. -- =============================================
  15. -- START    Callparamters
  16.  @struserID VARCHAR(MAX)
  17. -- END      Callparamters
  18.  
  19. AS
  20. BEGIN SET NOCOUNT ON;
  21.  
  22. DECLARE
  23.     @curJID         INT,
  24.     @curStorage     INT,
  25.     @maxstorage     INT,
  26.     @Freestorage INT
  27.  
  28.    
  29.     SET @curJID     = (SELECT JID FROM SRO_VT_ACCOUNT..TB_User WHERE StrUserID = @struserID);
  30.     SET @maxstorage     = (SELECT ChestSize FROM SRO_VT_SHARD.._ChestInfo WHERE JID = @curJID);
  31.     SET @curStorage     = (SELECT COUNT(ItemID) FROM SRO_VT_SHARD.._Chest WHERE UserJID = @curJID AND (ItemID != 0 AND ItemID IS NOT NULL))
  32.     SET @Freestorage    = @maxstorage - @curStorage;
  33.  
  34. END
  35.  
  36. BEGIN TRANSACTION  
  37.  
  38.     SELECT @Freestorage; -- PHP uses this to work properly!
  39.     RETURN @Freestorage; -- SQL uses this to work properly!
  40.  
  41. COMMIT TRANSACTION
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement