use [test1_AlplaPROD2.0_Read]

select 
customerartno
,r.ArticleHumanReadableId as article
,r.ArticleAlias as articleAlias
,ReleaseNumber
,h.CustomerOrderNumber as header
,l.CustomerLineItemNumber as lineItem
,r.CustomerReleaseNumber as releaseNumber
,r.LoadingUnits
,r.Quantity
,r.TradeUnits
,h.CustomerHumanReadableId
,r.DeliveryAddressDescription
,format(r.LoadingDate, 'MM/dd/yyyy HH:mm') as loadingDate
,format(r.DeliveryDate, 'MM/dd/yyyy HH:mm') as deliveryDate
,r.Remark
--,* 
from [order].[Release] as r (nolock)

left join
[order].LineItem as l (nolock) on
l.id = r.LineItemId

left join
[order].Header as h (nolock) on
h.id = l.HeaderId

WHERE releasestate not in (1, 2, 4)
AND r.deliverydate between getDate() + -[startDay] and  getdate() + [endDay]

order by r.deliverydate