[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]',
dbo.FormatFirstNameLastName(Orders.LastName, Orders.FirstName ) ),
CustomerName = dbo.FormatFirstNameLastName(Orders.LastName, Orders.FirstName )
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