Results 1 to 3 of 3

Thread: too much text

  1. #1
    Join Date
    Jan 2004
    Posts
    11

    Question Unanswered: too much text

    SELECT
    dbo.table_case.case_history


    returns too much text, I'd like to limit it to the first 200 characters.

    I thought to try
    LEFT (dbo.table_case.case_history, 200)
    but that gave me the error
    Server: Msg 8116, Level 16, State 2, Line 1
    Argument data type text is invalid for argument 1 of left function.


    Tried convert(text,dbo.table_case.case_history) and got the same error.

    So, I tried
    convert (varchar,dbo.table_case.case_history) and that did not error, but only gave me about 28 characters.

    LEFT (convert(varchar,dbo.table_case.case_history), 200)
    also gave me the same 28 characters.

    Thoughts?

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    You may be running into a default value. Try:

    convert (varchar(200),dbo.table_case.case_history)
    Paul

  3. #3
    Join Date
    Dec 2003
    Posts
    39

    substring

    text data type cant use left function, and case_history must be text.

    here is another option, use substring :
    select substring(case_history,1,200) from table_case
    Link Link

Posting Permissions

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