The multi-part identifier error

  • I've being trying to figured out why this error is happening but no lucky yet.

    The code:

    SELECT

    CONVERT(VARCHAR, S_OPERATION.DATE_OPER, 112) + ' ' + -- DATE OPER YYYYMMDD

    CONVERT(VARCHAR, S_OPERATION.OPE_TIME, 102) + ' ' +-- OPE TIME HH:MI:SS

    FNUMBER.FILE_SEQUENCY_REND + ' ' +-- BATCH NUMBER

    RIGHT(REPLICATE('0',16) + CONVERT(VARCHAR(16),

    DBO.F_EXTRACT_NBR_CHAR(RECEIVER.C_CPF)),16) + ' ' +-- RECEIVER CPF / CNPJ

    DBO.FN_FORMAT_RIGHT_SPACES(RECEIVER.C_NAME, 40) + ' ' +-- RECEIVER NAME

    RIGHT(REPLICATE('0',14) + CONVERT(VARCHAR(14),

    DBO.F_EXTRACT_NBR_CHAR(RECEIVER.C_PHONE1)),14) + ' ' +-- RECEIVER PHONE NUMBER

    DBO.FN_FORMAT_RIGHT_SPACES(RECEIVER.C_ADDRESS, 50) + ' ' +-- RECEIVER ADDRESS

    DBO.FN_FORMAT_RIGHT_SPACES(RECEIVER.C_CITY, 20) + ' ' +-- RECEIVER CITY

    DBO.FN_FORMAT_RIGHT_SPACES(S_ACCOUNT.ACCOUNT_STATE) + ' ' +-- RECEIVER STATE

    RIGHT(REPLICATE('0',14) + CONVERT(VARCHAR(14), DBO.F_EXTRACT_NBR_CHAR(RECEIVER.C_ZIP)),14) + ' ' +-- RECEIVER ZIP

    DBO.FN_FORMAT_RIGHT_SPACES(RECEIVERCOUNTRY.COUNTRY , 20) + ' ' +-- RECEIVER COUNTRY

    RIGHT(REPLICATE('0',3) + CONVERT(VARCHAR(3), ISNULL(S_BANK.BANK_NUMBER, 0)),3) + ' ' + -- BANK NUMBER

    DBO.FN_FORMAT_RIGHT_SPACES(S_ACCOUNT.AGENCY, 30) +' ' +-- AGENCY

    DBO.FN_FORMAT_RIGHT_SPACES(S_ACCOUNT.ACCOUNT, 16) +' ' +-- ACCOUNT NUMBER (CHAR)

    LEFT(ISNULL(S_ACCOUNT.ACCOUNT_TYPE, 'C/C'), 1) + ' ' + -- ACCOUNT TYPE

    DBO.FN_FORMAT_RIGHT_SPACES(SENDER.C_NAME, 40) +' ' +-- SENDER

    DBO.FN_FORMAT_RIGHT_SPACES(SENDER.C_CUSTOMER_ID, 40) +' ' +-- SENDER ID

    DBO.FN_FORMAT_RIGHT_SPACES(SENDER.C_ADDRESS, 50) + ' ' +-- SENDER ADDRESS

    DBO.FN_FORMAT_RIGHT_SPACES(SENDER.C_CITY, 20) + ' ' +-- SENDER CITY

    DBO.FN_FORMAT_RIGHT_SPACES(S_ACCOUNT.ACCOUNT_STATE,2) + ' ' +-- SENDER STATE

    RIGHT(REPLICATE('0',14) + CONVERT(VARCHAR(14), DBO.F_EXTRACT_NBR_CHAR(SENDER.C_ZIP)),14) + ' ' +-- RECEIVER ZIP

    DBO.FN_FORMAT_RIGHT_SPACES(SENDERCOUNTRY.COUNTRY , 20) + ' ' +-- SENDER COUNTRY

    RIGHT(REPLACE(REPLICATE('0', 15) + CAST(CAST(AMOUNT * RATE AS NUMERIC(15,2)) AS VARCHAR), '.', '') ,15) + ' ' +-- FOREING AMOUNT

    'L' + ' ' +-- CURRENCY TYPE L = LOCAL / D = DOLLAR

    'N' + ' ' +-- TRANS TYPE - N=NEW OR V=VOID

    RIGHT(REPLICATE('0',10) + CONVERT(VARCHAR(10), S_OPERATION.OPE_NUMBER),10) + ' ' +-- OPERATIONS NUMBER

    SPACE(20) + ';' + -- LIVRE

    SPACE(80) -- LIVRE

    AS LINE,

    S_OPERATION.DATE_OPER,

    S_OPERATION.OPE_TIME,

    S_OPERATION.FOREING,

    S_OPERATION.OPE_NUMBER,

    S_OPERATION.OPE_SUBNUMBER,

    S_OPERATION.MAKER,

    S_OPERATION.AMOUNT,

    S_OPERATION.FEE_AMOUNT,

    ISNULL(S_OPERATION.COM_STAR,0) AS COM_STAR

    FROM S_OPERATION, S_FILE_NUMBER FNUMBER

    JOIN S_CUSTOMER SENDER

    ON S_OPERATION.SENDER_ID = SENDER.C_CUSTOMER_ID

    JOIN S_CUSTOMER RECEIVER

    ON S_OPERATION.RECEIVER_ID = RECEIVER.C_CUSTOMER_ID

    JOIN S_COUNTRY SENDERCOUNTRY

    ON SENDER.C_COUNTRY_ID = SENDERCOUNTRY.COUNTRY_ID

    JOIN S_ACCOUNT

    ON S_OPERATION.ACC_ID = S_ACCOUNT.ACCOUNT_ID

    JOIN S_BANK

    ON S_ACCOUNT.BANK_ID = S_BANK.BANK_ID

    JOIN S_S_OPERATIONATION_PAYERBATCH

    ON S_OPERATION.OPE_NUMBER =

    S_OPERATIONATION_PAYERBATCH.OPE_NUMBER

    WHERE S_S_OPERATIONATION_PAYERBATCH.IDPAYERBATCH = @IDPAYERBATCH

    And the error

    Msg 4104, Level 16, State 1, Procedure sp_generate_payerbatch, Line 207

    The multi-part identifier "S_OPERATION.SENDER_ID" could not be bound.

    Msg 4104, Level 16, State 1, Procedure sp_generate_payerbatch, Line 209

    The multi-part identifier "S_OPERATION.RECEIVER_ID" could not be bound.

    Msg 4104, Level 16, State 1, Procedure sp_generate_payerbatch, Line 213

    The multi-part identifier "S_OPERATION.ACC_ID" could not be bound.

    Thanks for any help[/size]

  • Start with the first join and see how that goes

    SELECT TOP 100 *

    FROM S_OPERATION, S_FILE_NUMBER FNUMBER

    JOIN S_CUSTOMER SENDER

    ON S_OPERATION.SENDER_ID = SENDER.C_CUSTOMER_ID

    Are you trying to join 2 tables S_OPERATION and SENDER?

    Then this should work

    SELECT TOP 100 *

    FROM S_OPERATION AS O

    INNER JOIN SENDER AS S

    ON O.ENDER_ID = S._CUSTOMER_ID

  • Not sure your join makes sense. You'll need to fill in the question marks below, but this removes the mixed join types:

    FROM S_OPERATION

    JOIN S_CUSTOMER SENDER

    ON S_OPERATION.SENDER_ID = SENDER.C_CUSTOMER_ID

    JOIN S_CUSTOMER RECEIVER

    ON S_OPERATION.RECEIVER_ID = RECEIVER.C_CUSTOMER_ID

    JOIN S_COUNTRY SENDERCOUNTRY

    ON SENDER.C_COUNTRY_ID = SENDERCOUNTRY.COUNTRY_ID

    JOIN S_ACCOUNT

    ON S_OPERATION.ACC_ID = S_ACCOUNT.ACCOUNT_ID

    JOIN S_BANK

    ON S_ACCOUNT.BANK_ID = S_BANK.BANK_ID

    JOIN S_S_OPERATIONATION_PAYERBATCH

    ON S_OPERATION.OPE_NUMBER =

    S_OPERATIONATION_PAYERBATCH.OPE_NUMBER

    join S_FILE_NUMBER FNUMBER on ??????? = ???????

    WHERE S_S_OPERATIONATION_PAYERBATCH.IDPAYERBATCH = @IDPAYERBATCH


    And then again, I might be wrong ...
    David Webb

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply