﻿set xact_abort on;
go

begin transaction;
go

set ANSI_NULLS on;
go

/*************************************
* STORED PROCEDURE sp_delRow
* 	elimina un set di dati a partire dalla riga di una commessa
*
* modif.:	S.E.L.
* il:		2008.10.23
**************************************/
alter PROCEDURE sp_delRow
(
	@Original_Cod VARCHAR(50)
)
AS

BEGIN TRAN

	-- cancello log stati...
	DELETE FROM LogStatoIstObj
	WHERE     (IdxObj = @Original_Cod) 

	-- cancello ULP child
	DELETE FROM IstObj
	WHERE     (IdxObjMamma = @Original_Cod) 

	-- cancello riga...
	DELETE FROM IstObj
	WHERE     (IdxObj = @Original_Cod) 

COMMIT TRAN

RETURN
go

commit;
go


set xact_abort on;
go

begin transaction;
go

set ANSI_NULLS on;
go

/*************************************
* STORED PROCEDURE sp_delObj
* 	elimina un set di dati di una commessa
*
* modif.:	S.E.L.
* il:		2008.10.23
**************************************/
alter PROCEDURE sp_delObj
(
	@Original_Cod VARCHAR(50)
)
AS

	-- cancello log stati...
	DELETE FROM LogStatoIstObj
	WHERE     (IdxObj LIKE REPLACE(@Original_Cod,'D','%'))  
	
	-- cancello il resto!	
	DELETE FROM IstObj
	WHERE     (IdxObj LIKE REPLACE(@Original_Cod,'D','%')) 

RETURN
go

commit;
go





-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(134, GETDATE())
GO
