- Joined
- May 15, 2014
- Messages
- 81
- Reaction score
- 17
Режих да споделя с вас една малка частица от сайта ми http://slinemu.com/ половината на половината на половината, на тези където се правят на разбирачи да си бият главата, а тези където искат да им помогна да ми пишат на лс след време може би ще споделя друга половинка ПРОДЪЛЖЕНИЕТО е интересно
EXEC MoveCharacterAccount @NewAccount = 'noLove', @CharacterName = 'noLove' |
USE [MuOnline] GO CREATE PROCEDURE [dbo].[MoveCharacterAccount] @NewAccount varchar(10), @CharacterName varchar(10) AS BEGIN DECLARE @Eliminar tinyint DECLARE @Resultado tinyint SET @Eliminar = 0 SET @Resultado = 0 SET NOCOUNT ON SET XACT_ABORT ON IF EXISTS (SELECT * FROM AccountCharacter WHERE GameID1 = @CharacterName) BEGIN UPDATE AccountCharacter SET GameID1 = NULL WHERE GameID1 = @CharacterName UPDATE Character SET AccountID = @NewAccount where Name = @CharacterName SET @Eliminar = 1 END ELSE IF EXISTS (SELECT * FROM AccountCharacter WHERE GameID2 = @CharacterName) BEGIN UPDATE AccountCharacter SET GameID2 = NULL WHERE GameID2 = @CharacterName UPDATE Character SET AccountID = @NewAccount where Name = @CharacterName SET @Eliminar = 1 END ELSE IF EXISTS (SELECT * FROM AccountCharacter WHERE GameID3 = @CharacterName) BEGIN UPDATE AccountCharacter SET GameID3 = NULL WHERE GameID3 = @CharacterName UPDATE Character SET AccountID = @NewAccount where Name = @CharacterName SET @Eliminar = 1 END ELSE IF EXISTS (SELECT * FROM AccountCharacter WHERE GameID4 = @CharacterName) BEGIN UPDATE AccountCharacter SET GameID2 = NULL WHERE GameID4 = @CharacterName UPDATE Character SET AccountID = @NewAccount where Name = @CharacterName SET @Eliminar = 1 END ELSE IF EXISTS (SELECT * FROM AccountCharacter WHERE GameID5 = @CharacterName) BEGIN UPDATE AccountCharacter SET GameID5 = NULL WHERE GameID5 = @CharacterName UPDATE Character SET AccountID = @NewAccount where Name = @CharacterName SET @Eliminar = 1 END IF EXISTS (SELECT * FROM AccountCharacter WHERE Id = @NewAccount AND GameID1 IS NULL) BEGIN UPDATE AccountCharacter SET GameID1 = @CharacterName WHERE Id = @NewAccount SET @Resultado = 1 END ELSE IF EXISTS (SELECT * FROM AccountCharacter WHERE Id = @NewAccount AND GameID2 IS NULL) BEGIN UPDATE AccountCharacter SET GameID2 = @CharacterName WHERE Id = @NewAccount SET @Resultado = 1 END ELSE IF EXISTS (SELECT * FROM AccountCharacter WHERE Id = @NewAccount AND GameID3 IS NULL) BEGIN UPDATE AccountCharacter SET GameID3 = @CharacterName WHERE Id = @NewAccount SET @Resultado = 1 END ELSE IF EXISTS (SELECT * FROM AccountCharacter WHERE Id = @NewAccount AND GameID4 IS NULL) BEGIN UPDATE AccountCharacter SET GameID4 = @CharacterName WHERE Id = @NewAccount SET @Resultado = 1 END ELSE IF EXISTS (SELECT * FROM AccountCharacter WHERE Id = @NewAccount AND GameID5 IS NULL) BEGIN UPDATE AccountCharacter SET GameID5 = @CharacterName WHERE Id = @NewAccount SET @Resultado = 1 END IF @Resultado = 1 BEGIN PRINT 'Personaje cambiado correctamente' END ELSE BEGIN PRINT 'Error al cambiar el personaje' END IF @Eliminar = 1 BEGIN PRINT 'Personaje eliminado correctamente' END ELSE BEGIN PRINT 'Error al eliminar el personaje' END SET NOCOUNT OFF SET XACT_ABORT OFF END |