Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- USE [SRO_VT_CUSTOM]
- GO
- /****** Object: StoredProcedure [dbo].[sys_FreeStorageSlots] Script Date: 5/27/2016 11:31:51 AM ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[sys_FreeStorageSlots]
- -- =============================================
- -- Author: <tschulian>
- -- Create date: <27.05.2016>
- -- Description: <Returns the free Storage Slots of the selected User>
- -- =============================================
- -- START Callparamters
- @struserID VARCHAR(MAX)
- -- END Callparamters
- AS
- BEGIN SET NOCOUNT ON;
- DECLARE
- @curJID INT,
- @curStorage INT,
- @maxstorage INT,
- @Freestorage INT
- SET @curJID = (SELECT JID FROM SRO_VT_ACCOUNT..TB_User WHERE StrUserID = @struserID);
- SET @maxstorage = (SELECT ChestSize FROM SRO_VT_SHARD.._ChestInfo WHERE JID = @curJID);
- SET @curStorage = (SELECT COUNT(ItemID) FROM SRO_VT_SHARD.._Chest WHERE UserJID = @curJID AND (ItemID != 0 AND ItemID IS NOT NULL))
- SET @Freestorage = @maxstorage - @curStorage;
- END
- BEGIN TRANSACTION
- SELECT @Freestorage; -- PHP uses this to work properly!
- RETURN @Freestorage; -- SQL uses this to work properly!
- COMMIT TRANSACTION
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement