duda sobre scrip
Publicado por davis (33 intervenciones) el 22/10/2007 17:02:07
Hol foristas tengo el sgt problema
declare @c_1 varchar (50)
declare @c_2 varchar (50)
set @c_1 = null
set @c_2 = null
if ((@c_1 = @c_2) or (@c_1 is null and @c_2 is null ))
select 'igual'
else
select 'diferente'
/*PERO COMO HAGO SI ESTOS VALORES VIENEN DE TABLAS, NO SE COMO ENCAJAR
EL IF
PARA Q LA SCRIP FUNCIONE CORRECTAMENTE
ESTO LO USARE EN MI TRIGGER PARA COMPROBAR Q UNO DE ESTOS 3 CAMPOS REALMENTE CAMBIARON DESPUES DE UN UPDATE , LAS TABLAS SON INSERTED Y DELETED
*/
IF
((del.Codigo = ins.Codigo ) or (del.Codigo is null and ins.Codigo is null) ) AND
((del.Codmarca = ins.Codmarca ) or (del.Codmarca is null and ins.Codmarca is null) )
from Inserted ins ,deleted del
select 'igual'
ELSE
select 'diferente'
sus comentarios seran bienbenidos
declare @c_1 varchar (50)
declare @c_2 varchar (50)
set @c_1 = null
set @c_2 = null
if ((@c_1 = @c_2) or (@c_1 is null and @c_2 is null ))
select 'igual'
else
select 'diferente'
/*PERO COMO HAGO SI ESTOS VALORES VIENEN DE TABLAS, NO SE COMO ENCAJAR
EL IF
PARA Q LA SCRIP FUNCIONE CORRECTAMENTE
ESTO LO USARE EN MI TRIGGER PARA COMPROBAR Q UNO DE ESTOS 3 CAMPOS REALMENTE CAMBIARON DESPUES DE UN UPDATE , LAS TABLAS SON INSERTED Y DELETED
*/
IF
((del.Codigo = ins.Codigo ) or (del.Codigo is null and ins.Codigo is null) ) AND
((del.Codmarca = ins.Codmarca ) or (del.Codmarca is null and ins.Codmarca is null) )
from Inserted ins ,deleted del
select 'igual'
ELSE
select 'diferente'
sus comentarios seran bienbenidos
Valora esta pregunta


0