[dbo].[MssWebGetOrderSakariPersonnelContacts]
create procedure [dbo].[MssWebGetOrderSakariPersonnelContacts]
(
@inOrderId int
)
as
begin
set nocount on
select
PersonnelType = PersonnelData.PersonnelType,
UserName = PersonnelData.Personnel,
CountryCode = isnull(CountryCodeStandard.PhoneCountryCode, DefaultCountryCode.PhoneCountryCode),
CountryCodeStandardId = isnull(CountryCodeStandard.CountryCodeStandardID, DefaultCountryCode.CountryCodeStandardID),
AreaCode = SysUserPhoneNumber.AreaCode,
LocalNumber = SysUserPhoneNumber.LocalNumber,
PhoneType = SysUserPhoneType.TypeName
from dbo.udfGetOrderPersonnel( @inOrderId ) PersonnelData
cross join dbo.getDefaultCountry() as DefaultCountryCode
inner join Sysuser on Sysuser.SysUserID = PersonnelData.SysUserID
inner join SysUserPhoneNumber on SysUserPhoneNumber.SysUserFID = Sysuser.SysUserID
left outer join SysUserPhoneType on SysUserPhoneType.SysUserPhoneTypeID = SysUserPhoneNumber.SysUserPhoneTypeFID
left outer join CountryCodeStandard on SysUserPhoneNumber.CountryCodeStandardFID = CountryCodeStandard.CountryCodeStandardID
where SysUserPhoneType.TypeName='cell'
end
GO
GRANT EXECUTE ON [dbo].[MssWebGetOrderSakariPersonnelContacts] TO [MssExec]
GO