Bienvenidos a un nuevo tutorial, el siguiente procedimiento corresponde a la versión 0.97D del MuOnline y se titula WZ_GuildCreate
--www.muonlinetutoriales.com
--by asd*
CREATE procedure WZ_GuildCreate
@GuildName nvarchar(50),
@MasterName nvarchar(10)
as
if (SELECT COUNT(*) FROM guild where G_Name=@GuildName )=0
BEGIN
DECLARE @ErrorCode int
SET @ErrorCode = 0
SET XACT_ABORT OFF
Set nocount on
begin transaction
INSERT INTO Guild (G_Name,G_Master,G_Score) valueS (@GuildName, @MasterName, 1)
IF ( @@Error <> 0 )
BEGIN
SET @ErrorCode = 1
END
IF ( @ErrorCode = 0 )
BEGIN
INSERT GuildMember (Name, G_Name, G_Level) valueS (@MasterName, @GuildName, 1)
IF ( @@Error <> 0 )
BEGIN
SET @ErrorCode = 2
END
END
IF ( @ErrorCode <> 0 )
rollback transaction
ELSE
commit transaction
select @ErrorCode
Set nocount off
SET XACT_ABORT ON
END
GO