the query :
Select 1 as rType, m.UID, m.OrderNumber, M.Closed,
M.Invoiced, M.BillingStat,
t.UID as oUID, t.TechUID, t.DateIn, t.Tech, T.TimeStart, t.TimeEnd,
M.OrderStatus, OS.Color, t.IsSub, t.TotalHours, T.StartDateTime, T.EndDateTime, 1 as Layer
from Service M, OrderTech T
left outer join OrderStatus OS on M.OrderStatusUID = OS.UID
where M.projectUID = :UID and M.UID = T.OrderUID
and (:OrderUID is null or m.UID = :OrderUID)
The error (from msSQL)
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "M.OrderStatusUID" could not be bound.
I have also tried including M.OrderStatusUID in the query, but still get the same error.
Any ideas?