Check room availability in hotel system

  • [font="Times New Roman"][/font]

    I'm a university student and I'm developing a database for a hotel system ,now I'm stack when I try to check rooms that are available for a specific date,room_status and type of a room.I'm using SQL server 2008, I have two table that m checking on which are : dbo.RoomBooking(Booking_ID,Room_Number,Arrival_date,Departure_date) , dbo.Rooms(Room_Number,Room_type,Room_status)

    I hv tried this query: create proc GetAvailableRoom

    (@RT_Name char(15), @ArriveDate Date, @DepDate Date)

    AS SELECT Room_no from Rooms r ,Room_Type rt

    WHERE r.Room_Type_Code = rt.Room_Type_Code and

    Room_no NOT IN (Select Room_no FROM Room_Bookings

    Where Chck_in_Date Between @ArriveDate and @DepDate and

    Chck_out_Date between @ArriveDate and @DepDate)

    and rt.Room_Type_Name = @RT_Name and Room_Status = 'Avail'

    go

  • Please don't cross post. It just wastes peoples time and fragments replies.

    No replies to this thread please. Direct replies to: http://www.sqlservercentral.com/Forums/Topic1350128-391-1.aspx

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply