IF EXISTS (SELECT * FROM SYSOBJECTS O, SYSUSERS U
           WHERE O.NAME = 'GERA_ACRES_PEDCOLETA' AND
                 TYPE = 'FN' 		       AND
	              U.UID = O.UID            AND
	              U.NAME = USER)
DROP FUNCTION GERA_ACRES_PEDCOLETA
GO

CREATE FUNCTION GERA_ACRES_PEDCOLETA
                          (@P_CDPRODINI       VARCHAR(100),
                           @P_CDPRODFIN       VARCHAR(100),
                           @P_CDFILIAL        VARCHAR(100),
                           @P_MARCA           VARCHAR(100),
                           @P_COMPRADOR       VARCHAR(100),
                           @P_REGIAO          VARCHAR(100),
                           @P_FORNECED        VARCHAR(100),
                           @P_NRCOMPRA        VARCHAR(100),
                           @P_DTINI           DATE   ,
                           @P_DTFIN           DATE   ,
                           @P_BOACRESITENCONS VARCHAR(100))
                           RETURNS VARCHAR
AS
BEGIN
   DECLARE @V_VARIAVEL  VARCHAR(100);
   SET @V_VARIAVEL = @P_CDPRODINI;
   RETURN(@V_VARIAVEL);
END
GO

-- VERSAO --
EXEC ATUVEROBJ 'GERA_ACRES_PEDCOLETA','5.70.XXX';
GO