Stored Procedures [dbo].[LookupAccountingCustomerIdByCustomerNumber]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)Direction
@inCustomerNumbervarchar(15)15
@outAccountingCustomerIdint4Out
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
/**
*    Looks up the AccountingCustomerId for the specified CustomerNumber.
*    
*    Parameters:
*    @inCustomerNumber - the customer number
*    @outAccountingCustomerId - the returned AccountingCustomerId, if found.
*/

CREATE PROCEDURE [dbo].[LookupAccountingCustomerIdByCustomerNumber]
    @inCustomerNumber varchar(15),
    @outAccountingCustomerId int output
as
set nocount on

set @outAccountingCustomerId = null

if( isnull( @inCustomerNumber, '' ) != '' )
begin
    select
        @outAccountingCustomerId = AccountingCustomerId
    from AccountingCustomer
    where CustomerNumber = @inCustomerNumber
end
GO
GRANT EXECUTE ON  [dbo].[LookupAccountingCustomerIdByCustomerNumber] TO [MssExec]
GO
Uses