[dbo].[MssWebGetSmsOrderLevelInformation]
CREATE procedure [dbo].[MssWebGetSmsOrderLevelInformation]
@inOrderId int
as
begin
set nocount on
select
SakariAccountPriKey = SakariAccount.SakariAccountID,
SakariAccountId = SakariAccount.AccountId,
OrderNumber = coalesce(
Orders.OrderNo,
Orders.ArchivedOrderNo + ' [A]' ) ,
CustomerName = dbo.FormatFirstNameLastName(Orders.FirstName,Orders.LastName)
from Orders
inner join Branch on Orders.BranchPriKey = Branch.BranchPriKey
left outer join SakariAccountBranchMap on Branch.BranchPriKey = SakariAccountBranchMap.BranchFID
left outer join SakariAccount on SakariAccountBranchMap.SakariAccountFID = SakariAccount.SakariAccountID
where Orders.PriKey =@inOrderId
end
GO
GRANT EXECUTE ON [dbo].[MssWebGetSmsOrderLevelInformation] TO [MssExec]
GO