Skip to main content
Inspiring
May 4, 2006
Answered

QoQ in CF5 appears to be truncating strings

I have a query that I wish to sort. However, everytime I sort the query a couple of the string columns get truncated to 2 characters.

Here's an example of the query. The name column gets truncated.

<cfquery name="tmpQrySort" dbtype="query">
SELECT * FROM tmpQry ORDER BY name
</cfquery>

Yes, this is still on a CF5 environment.
    This topic is closed to new replies. Start a new post to keep the conversation going.
    fhh98Correct answer
    Inspiring
    May 5, 2006
    quote:

    Originally posted by: fhh98
    Q: From a "are things working" perspective, if you cfdump your original query, does the name field get truncated? What about if you don't use an order by clause in your Q of Q?

    A: A cfdump of the original query does show the proper values.

    What about when you run a QofQ without an order by clause?


    Yes, the problem occurs if I don't include the ORDER BY clause.

    Thank you for pointing that out. This appears related to the QoQ messing up the datatype. If I modify my original database query to pad spaces to the max length of the name field the error goes away.

    4 replies

    Inspiring
    May 4, 2006
    From a "are things working" perspective, if you cfdump your original query, does the name field get truncated? What about if you don't use an order by clause in your Q of Q?

    From a "are you really doing that" perspective, why don't you just put your order by clause in the tmpqry query?
    Translate
    fhh98Author
    Inspiring
    May 4, 2006
    Q: From a "are things working" perspective, if you cfdump your original query, does the name field get truncated? What about if you don't use an order by clause in your Q of Q?

    A: A cfdump of the original query does show the proper values.

    Q: From a "are you really doing that" perspective, why don't you just put your order by clause in the tmpqry query?

    A. The query has been constructed from a variety of datasources.

    The original query from the database return's the following columns.

    1. code
    2. value
    3. name (blank column)
    4. language_code (blank column)

    We use a code because the name is localized. The code can then be used to find out what the proper name should be and that is added to the query though QuerySetCell.

    I cannot join the name to the code in the database. For various reasons, not all codes have localized names. When that occurs I have to search for a proper substitute. I add the language code to the query to show the user what language the name is in.

    For example, say I have a widget with a height of 99 units. The database would return the code associated with height (254) and the value (99).

    If the user's preferred language is French the name would be taille and the language code would be FR. If for some reason there wasn't a French name available the American English name would be returned with a language code of US.
    Translate
    Inspiring
    May 4, 2006
    quote:

    Originally posted by: fhh98
    Q: From a "are things working" perspective, if you cfdump your original query, does the name field get truncated? What about if you don't use an order by clause in your Q of Q?

    A: A cfdump of the original query does show the proper values.

    What about when you run a QofQ without an order by clause?

    Translate