
/****** Object:  StoredProcedure [dbo].[Calc_Habit_Ocup_Hotel_NoOut]    Script Date: 11/27/2014 15:57:48 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO






DROP  PROCEDURE [dbo].[Calc_Habit_Ocup_Hotel_Presente] 
GO

CREATE  PROCEDURE [dbo].[Calc_Habit_Ocup_Hotel_Presente] @dia datetime,@total int output
AS
begin
  Select @total = Count(id_face) 
  From   Hoteface 
  Where  @dia BETWEEN CAST(DATEADD(DAY, 1, fecha_ent) AS DATE)
    AND  CAST(DATEADD(DAY, -1, fecha_sal) AS DATE)

  if @total is null
    Select @total = 0
end























