IF EXISTS (select status, statusrl,* from reservations r (nolock)
Inner join RESERVATIONROOMLINEXTAB rlx (NOLOCK) On r.ReferenceNumber = rlx.ReferenceNumber and r.GuestNumber = rlx.GuestNumber
INNER JOIN RESERVATIONROOMLINE rl (NOLOCK) ON rl.LINENUMBER = rlx.LINENUMBER
where status = 7 and ISNULL(statusrl, 0) <> 7)

	UPDATE ReservationRoomline
	Set StatusRL = 7
	FROM reservations r (nolock)
	Inner join RESERVATIONROOMLINEXTAB rlx (NOLOCK) On r.ReferenceNumber = rlx.ReferenceNumber and r.GuestNumber = rlx.GuestNumber
	INNER JOIN RESERVATIONROOMLINE rl (NOLOCK) ON rl.LINENUMBER = rlx.LINENUMBER
	where status = 7 and ISNULL(statusrl,0) <> 7