Para quem esta com problemas com o comando do "/bau" aqui esta a procedure...
CREATE PROCEDURE [dbo].[Mudar_Bau]
@login varchar(10),
@futureVaultID tinyint
AS
Begin
DECLARE
@actualVaultID tinyint,
@actualVaultItem varbinary(1200),
@futureVaultItem varbinary(1200),
@actualMoney int,
@futureMoney int
SELECT @actualVaultID = VaultID FROM warehouse WHERE AccountID = @login
IF (@actualVaultID <> @futureVaultID)
Begin
IF EXISTS ( SELECT * FROM ExtWarehouse WHERE VaultID = @futureVaultID AND AccountID = @login )
Begin
SELECT @actualVaultItem = Items FROM warehouse WHERE AccountID = @login
SELECT @futureVaultItem = Items FROM ExtWarehouse WHERE AccountID = @login and vaultid=@futureVaultID
SELECT @actualMoney = Money FROM warehouse WHERE AccountID = @login
SELECT @futureMoney = Money FROM ExtWarehouse WHERE AccountID = @login and vaultid=@futureVaultID
INSERT INTO ExtWarehouse (AccountID, Items, Money, VaultID) VALUES (@login, @actualVaultItem, @actualMoney, @actualVaultID)
UPDATE warehouse SET Items = @futureVaultItem, Money = @futureMoney, VaultID = @futureVaultID WHERE AccountID = @login
DELETE FROM ExtWarehouse WHERE VaultID = @futureVaultID AND AccountID = @login
End
ELSE
Begin
SELECT @actualVaultItem = Items FROM warehouse WHERE AccountID = @login
SELECT @actualMoney = Money FROM warehouse WHERE AccountID = @login
INSERT INTO ExtWarehouse (AccountID, Items, Money, VaultID) VALUES (@login, @actualVaultItem, @actualMoney, @actualVaultID)
UPDATE warehouse SET Items = NULL, Money = NULL, VaultID = @futureVaultID WHERE AccountID = @login
End
End
End
GO
Caso não resolva, me manda MP que estarei ajudando os demais.