Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2002
    Posts
    9

    Question Unanswered: Truncated Error - All Should Fit

    i created the following stored proc below. My problem is that I get an error
    " Server: Msg 8152, Level 16, State 9, Procedure MgmtPopulatetempBatchDisable, Line 17
    String or binary data would be truncated."


    Note that the target table columns are equal size. I running the stored proc with " mgmtpopulatetempbatchdisable 'PCREFXXX 33 4/2001 11:33:35 PM' "


    ALTER PROCEDURE MgmtPopulatetempBatchDisable
    @tempOID varchar(255)

    AS
    SET

    DECLARE @Authcode AS varchar(20)

    Set @Authcode = (SELECT a.authcode from tbl_account a INNER JOIN tbl_other o ON a.accountid = o.accountid where o.oid = @TEMPOID)

    BEGIN TRANSACTION

    INSERT INTO tbl_BatchDisable
    VALUES (@tempOID, @Authcode)
    Commit





    GO
    SET QUOTED_IDENTIFIER OFF
    GO
    SET ANSI_NULLS ON
    GO

    Thanks

  2. #2
    Join Date
    Oct 2002
    Posts
    369

    Question Re: Truncated Error - All Should Fit

    Q1 Is O.OID a varchar(255)?

    {since you have:
    i @tempOID varchar(255)
    ii (SELECT a.authcode from tbl_account a INNER JOIN tbl_other o ON a.accountid = o.accountid where O.OID = @TEMPOID)
    iii the error "String or binary data would be truncated"
    }

  3. #3
    Join Date
    Nov 2002
    Posts
    9
    thanks for responding
    Yes, o.oid is varchar (255)

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    What is the definition for a.authcode ? How is tbl_BatchDisable defined ?

  5. #5
    Join Date
    Oct 2002
    Posts
    369

    Question Re: Truncated Error - All Should Fit

    Q2 And are tbl_BatchDisable columns 1 and 2 varchar (255) and varchar (20) respectively i.e.:
    INSERT INTO tbl_BatchDisable
    VALUES (@tempOID, @Authcode)}

  6. #6
    Join Date
    Nov 2002
    Posts
    9
    Originally posted by rnealejr
    What is the definition for a.authcode ? How is tbl_BatchDisable defined ?

    a.authcode is a varchar(20)
    tbl_BatchDisable
    authcode varchar (20)
    OID varchar (255)

  7. #7
    Join Date
    Nov 2002
    Posts
    9
    Hi Guys,
    Your questions have allowed me to see the problem. I transposed the insert columns and its worked!
    Thanks to you all, have a nice evening

  8. #8
    Join Date
    Feb 2002
    Posts
    2,232
    Happy to help. In the future, while you are debugging try putting in extra lines to locate where the error is actually occurring - you will see the error line number increase and that will help you find the exact statement that is having the problem. Once you have isolated the statement, it is much easier to solve the problem.

    Good luck.

  9. #9
    Join Date
    Oct 2002
    Posts
    369

    Wink

    You are welcome and, RE:

    rnealejr:
    Happy to help. In the future, while you are debugging try putting in extra lines to locate where the error is actually occurring - you will see the error line number increase and that will help you find the exact statement that is having the problem. Once you have isolated the statement, it is much easier to solve the problem.
    Good luck.
    Yes; indeed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •