Stored Procedures [dbo].[GetPlasticWebDealBranchID]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)Direction
@inMoversConnectIdbigint8
@outBranchIDvarchar(5)5Out
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
/*
*    Description: Get a plastic web deal's BranchID by knowing it's MoversConnectID
**/

create procedure [dbo].[GetPlasticWebDealBranchID]
    @inMoversConnectId bigint,
    @outBranchID varchar(5) output
as
set nocount on

set @outBranchID = isnull( (
    select top 1    -- There should only be one such record, but there is no guarantee.
        Branch.BranchID
    from PlasticWebDeal
    inner join Branch on Branch.BranchPriKey = PlasticWebDeal.BranchPriKey
    where PlasticWebDeal.MoversConnectFID = @inMoversConnectId
), '' )
GO
GRANT EXECUTE ON  [dbo].[GetPlasticWebDealBranchID] TO [MssExec]
GO
Uses