SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO



IF EXISTS (SELECT name FROM sysobjects 
         WHERE name = 'CIZLBALL' AND type = 'P')
   DROP PROCEDURE CIZLBALL
GO

CREATE PROCEDURE CIZLBALL
@P_REPORT_CD CHAR(12),
@P_USER_ID CHAR(8)

AS


/******************************************************************************
   NAME:       CIZLBALL
   PURPOSE:    Standard Extract Labels for Crystal Report
******************************************************************************/

  DECLARE   @V_LANGUAGE_CD CHAR(3)

BEGIN
      SELECT @V_LANGUAGE_CD=LANGUAGE_CD
      FROM   SC_USER
      WHERE  SC_USER.USER_ID = @P_USER_ID;
      IF	(SELECT @@ROWCOUNT) = 0
      BEGIN
	SELECT @V_LANGUAGE_CD = 'ENG'
      END

          SELECT   RL.SEQ_NUM, 
		RL.FLD_NAME, 
		LTRIM (RTRIM (FL.LABEL_LONG)) LABEL_LONG, 
		RL.REPORT_CD
       FROM     CI_MD_RPT_LBL RL,
                CI_MD_FLD_L FL
       WHERE    RL.FLD_NAME = FL.FLD_NAME
       AND      RL.REPORT_CD = @P_REPORT_CD
       AND      FL.LANGUAGE_CD = @V_LANGUAGE_CD
       ORDER BY RL.SEQ_NUM;


    RETURN
END



GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

