¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.



 
ÍndiceÚltimas imágenesBuscarRegistrarseConectarse

 

 [Aporte] Borrar Items dup desde Sql

Ir abajo 
AutorMensaje
~Xtreme
Global Moderador
Global Moderador
~Xtreme


Masculino
Mensajes Mensajes : 75
Puntos Puntos : 197
Reputacion Reputacion : 1
Inscripción Inscripción : 27/01/2011
Edad : 28
Localización : Córdoba Capital , Argentina

[Aporte] Borrar Items dup desde Sql  Empty
MensajeTema: [Aporte] Borrar Items dup desde Sql    [Aporte] Borrar Items dup desde Sql  I_icon_minitimeSáb Ene 29, 2011 9:22 pm

Este código deben pegarlo en el analizador de consultas SQL y precionar la tecla F5, recomiendo que el servidor este offline durante este proceso. Dependiendo la cantidad de cuentas que haya, puede demorar horas, o minutos.
Código:
use MuOnline
GO

--Characters Check

declare @items varbinary(1920),
@user nvarchar(10),
@char nvarchar(10),
@serial varbinary(4),
@item varbinary(16),
@id int,
@toupdate int,
@numb int;

declare tempvar scroll cursor for select [Name] from [Character];
open tempvar
fetch next from tempvar into @char;
while (@@fetch_status = 0) begin
set @id=0;
set @items=(select [Inventory] from [Character] where [Name]=@char);
set @toupdate = 0;
while (@id<120) begin
set @item = substring(@items,16*@id+1,16);
set @serial = substring(@item,4,4);
if ((@serial!=0xFFFFFFFF) and (@serial!=0x00000000)) begin
if (((select count(*) from [warehouse] where (charindex (@serial, Items) %16=4)) > 0)
OR ((select count(*) from [Character] where [Name]!=@char and (charindex (@serial, Inventory) %16=4)) > 0)
OR ((select count(*) from [ExtWarehouse] where (charindex (@serial, Items) %16=4)) > 0))
begin
set @toupdate = 1;
set @items = substring(@items ,1,16*@id)+0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF+subs tring(@items ,16*@id+17,len(@items))
end
end
set @id = @id+1;
end
if (@toupdate=1) update [Character] set [Inventory]=@items where [Name]=@char;
fetch next from tempvar into @char;
end
close tempvar
deallocate tempvar

-- Warehouse Check
declare tempvar scroll cursor for select [AccountId] from [warehouse];
open tempvar
fetch next from tempvar into @user;
set @id=0;
set @items=(select [items] from [warehouse] where [Accountid]=@user);
set @toupdate = 0;
while (@id<120) begin
set @item = substring(@items,16*@id+1,16);
set @serial = substring(@item,4,4);
if ((@serial!=0xFFFFFFFF) and (@serial!=0x00000000)) begin
if (((select count(*) from [warehouse] where [AccountId]!=@user and (charindex (@serial, Items) %16=4)) > 0)
OR ((select count(*) from [Character] where (charindex (@serial, Inventory) %16=4)) > 0)
OR ((select count(*) from [ExtWarehouse] where (charindex (@serial, Items) %16=4)) > 0))
begin
set @toupdate = 1;
set @items = substring(@items ,1,16*@id)+0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF+subs tring(@items ,16*@id+17,len(@items))
end
end
set @id = @id+1;
end
if (@toupdate=1) update [warehouse] set [items]=@items where [AccountId]=@user;
fetch next from tempvar into @user;
close tempvar
deallocate tempvar

-- ExtWarehouse Check

declare tempvar scroll cursor for select [AccountId],[Number] from [ExtWarehouse];
open tempvar
fetch next from tempvar into @user, @numb;
set @id=0;
set @items=(select [items] from [ExtWarehouse] where [Accountid]=@user and [Number]=@numb);
set @toupdate = 0;
while (@id<120) begin
set @item = substring(@items,16*@id+1,16);
set @serial = substring(@item,4,4);
if ((@serial!=0xFFFFFFFF) and (@serial!=0x00000000)) begin
if (((select count(*) from [warehouse] where (charindex (@serial, Items) %16=4)) > 0)
OR ((select count(*) from [Character] where (charindex (@serial, Inventory) %16=4)) > 0)
OR ((select count(*) from [ExtWarehouse] where [AccountId]!=@user and [Number]!=@numb and (charindex (@serial, Items) %16=4)) > 0))
begin
set @toupdate = 1;
set @items = substring(@items ,1,16*@id)+0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF+subs tring(@items ,16*@id+17,len(@items))
end
end
set @id = @id+1;
end
if (@toupdate=1) update [ExtWarehouse] set [items]=@items where [AccountId]=@user and [Number]=@numb;
fetch next from tempvar into @user;
close tempvar
deallocate tempvar

Espero que les sirva, saludos.

Atte:~Xtreme Exclamation
Volver arriba Ir abajo
http://mundo.1talk.net/
 
[Aporte] Borrar Items dup desde Sql
Volver arriba 
Página 1 de 1.
 Temas similares
-
» [Aporte] Borrar Clanes
» [Aporte] Files 1.06A+166 NEW ITEMS
» [Aporte] Agregar items al inventario a la hora de crear personaje
» [Guia]Crear Mu Season 4. 160 Items Agregados
» [Guía] Listar cuentas con ITEMS FULL OPC

Permisos de este foro:No puedes responder a temas en este foro.
 :: Juegos Online :: Mu Online :: Ayuda y Creacion de Servers de Mu :: Desarrollo, Programación y Seguridad-
Cambiar a: