DROP PROCEDURE IN_CopiaPriceLeveltemDetProc
GO
CREATE PROCEDURE IN_CopiaPriceLeveltemDetProc
(	@CORRNBR int,
	@SITEID UD_IDSITE,
	@BATNBR  UD_CORRELATIVOS
)
AS
BEGIN    
	BEGIN TRAN
	DECLARE   @ERROR	integer


       INSERT 	INTO 	TMP_IN_PRICELEVELTEMDET(CORRNBR,SITEID,SEQUENCE,INVTIDSKU,DESCR,SLS_PRICE,DISCMTO,NEWSLS_PRICE,STDCOST)
		SELECT 	@CORRNBR,SITEID,SEQUENCE,INVTIDSKU,DESCR,SLS_PRICE,DISCMTO,NEWSLS_PRICE,STDCOST
		FROM	IN_PRICELEVELTEMDET
		WHERE	BATNBRPRICELEVELTEM=@BATNBR AND SITEID=@SITEID

	IF (@@error!=0 OR @@ROWCOUNT=0 )
    	BEGIN
		ROLLBACK  
      		RETURN(1)
    	END
  COMMIT TRAN
  RETURN (0)

END
