Scalar-valued Functions [dbo].[GetAccountingVendorId_XLedger]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@inVendorIdvarchar(15)15
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
/*
*    Gets an Accounting Vendor primary key by Vendor ID.
*    The GetAccountingVendorId_Synonym will be set to use the appropriate function for the current
*    system, based upon if they have XLedger, GP, QuickBooks or no accounting system.
*/

create function [dbo].[GetAccountingVendorId_XLedger]( @inVendorId varchar(15) )
returns int
as
begin
    declare @theAccountingVendorId int
    select @theAccountingVendorId =
        case
            when rtrim( isnull( @inVendorId, '' ) ) = '' then null
            else AccountingVendor.AccountingVendorId
        end
    from AccountingVendor
    where AccountingVendor.VendorNumber = rtrim( @inVendorId )
    return @theAccountingVendorId
end
GO
GRANT EXECUTE ON  [dbo].[GetAccountingVendorId_XLedger] TO [MssExec]
GO
Uses