Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2010
    Posts
    25

    Unanswered: Truncating text as per the size of columnin SP

    Hi All,

    I have one comment field in my stored procedure which is of the size VARCHAR(200) but the database column I am fetching data from is of 500 VARCHAR.
    DB2 does not truncates the text automatically and throws error when I execute my procedure. I dont want to increase the field size in my procedure so how can I restrict to fetch only first 200 characters and ignore other text?

    Thanks

  2. #2
    Join Date
    May 2008
    Posts
    17
    you could use the LEFT() function

    select LEFT(<column>,200)

    would select the first 200 characters from the column.

  3. #3
    Join Date
    Jun 2010
    Posts
    25

    Thumbs up

    Quote Originally Posted by TonyF123 View Post
    you could use the LEFT() function

    select LEFT(<column>,200)

    would select the first 200 characters from the column.
    Thanks Tony, its working.

Posting Permissions

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