SQL 2008 database update
We have a table in a hotel management system, the table is called RoomAvailability, the fields are roomID int, roomDate DateTime, Available bit.... the roomDate field is populated with every single day of the year, as a client is booked the relevant days are supposed to be marked unavailable.... could some one please help us with the SQL statement to update this table because its been a long time now that we're stuck on this
Rajul AggarwalPosted Jun 30, 2009, 5:57 AM
If you wanna know whether the room is available or not on certain date then you can use the following query for it.
-----------------------------------------------------------------------------------------
declare @myDate datetime
set @myDate = '2009-07-16'
select roomId,
case available
when 1 then 'Available'
when 0 then 'Unavailable'
else 'Unavailable'
end
from dbo.tbRoomAvailability where roomdate=@myDate
-----------------------------------------------------------------------------------------------------
Regards,
Rajul Aggarwal