Rename Query Column Name

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Rename Query Column Name

    I know I can rename the column in the db by using AS, but I don't have those
    priv's and I've got some really ugly column names which I'd like to rename to
    something nicer when I CFQUERY the data into a record set. Thoughts anyone?

    DickBobUK Guest

  2. Similar Questions and Discussions

    1. Query by column name & output
      Hi I have a lot of column names that have a value of 1 or 0. HasRadio 1 BarLounge 0 IndoorPool 1 etc etc. I am thinking of the best way to query...
    2. Column width query
      Sorry this is a repost: Hi, I am wanting to display data in a datagrid with additional header rows above it that categorise some of the main...
    3. how to query a column name with special character
      i was able to create a table with a column name abc\ on db2 v8.1 on windows, but when i do the query select abc\ from table, i get error '\' is...
    4. Sum a column of values from a MySQL query
      I am trying to sum a query of values from a MySQL table. The code I am using is: ---BEGIN CODE #1-------------- $sql_2 = "SELECT...
    5. how to add another column to a query result?
      hi guys, I have a query that will return 4 record with 1 column. I want to add another "title" column for the four record. The query is design so...
  3. #2

    Default Re: Rename Query Column Name

    If you are writing the query using CFQUERY then you can use AS to create an alias for the column names.
    TA-Selene Guest

  4. #3

    Default Re: Rename Query Column Name

    Sorry, I shoud have been more clear.

    I'm calling a stored procedure so I can't rename the columns using AS in CFQUERY.
    DickBobUK Guest

  5. #4

    Default Re: Rename Query Column Name

    Use query of query.

    <cfstoredproc result="qResult" ... />

    <cfquery dbType="query">
    SELECT ReallyLongAndUglyColumnNameLikeThis as newCol1
    FROM qResult
    </cfquery>
    kyle969 Guest

  6. #5

    Default Re: Rename Query Column Name

    If the column names are much longer than the data values and it is a large
    resultset you should recomend changing them to the DBA. If the record is 20
    bytes and the column names are 256 bytes, each record is sent over the network
    as 256 bytes, the execution time would be greatly improved if the column names
    were smaller.

    kyle969 Guest

  7. #6

    Default Re: Rename Query Column Name

    Thanks for your comments Kyle. I was trying to avoid the processing/memory of
    doing a query of query, but I guess it's the only way. Good point you raised
    about the overhead of long column names. I hadn't thought of that before!

    DickBobUK Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139