/*
update ReservationRoomline
Set StatusRL = r.Status
from reservationroomline rl (NOLOCK)
inner join reservationroomlinextab rlx (NOLOCK) on rl.LINENUMBER = rlx.LINENUMBER and rlx.ReferenceNumber > 0
INNER JOIN RESERVATIONS r (NOLOCK) ON R.ReferenceNumber = rlx.ReferenceNumber AND r.GuestNumber = rlx.GuestNumber
where (statusrl is null) or statusrl = 9


update reservationroomline 
Set statusrl = r.status
FROM Reservationroomline rl (nolock)
inner join RESERVATIONROOMLINEXTAB rlx (nolock) on rl.LINENUMBER = rlx.LINENUMBER
inner join reservations r on r.ReferenceNumber = rlx.ReferenceNumber and r.guestnumber = rlx.GuestNumber
where r.guestnumber > 0 and status <> ISNULL(statusrl, -1)

*/