USE [Accounting]
GO
/****** Object:  UserDefinedFunction [dbo].[ex_Get_Id_Peri]    Script Date: 08/09/2012 11:25:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO





ALTER FUNCTION [dbo].[ex_Get_Id_Peri] ( @id_ejer   smallint   ,
			        @periodo   varchar(20) 
			      )
RETURNS int
AS
BEGIN
  declare @id_peri int

  Select @id_peri = id_peri
   From contperi
    Where id_ejer = @id_ejer  and
	  RTRIM(UPPER(titulo)) = RTRIM(UPPER(@periodo))

  RETURN @id_peri
END










