Preserving leading zeroes in a query

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

  1. #1

    Default Preserving leading zeroes in a query

    Hello,

    I'm trying to run a query of queries on an employee directory, and use the
    employees id number to link to a "Details" page. Unfortunately, these id
    numbers are of varying lengths and have leading zeroes which are stripped out
    when my QofQ runs. The few suggestions I've seen for dealing with leading
    zeroes all relate to using numberFormat() or the SQL ZEROFILL command. But,
    since my numbers are of varying lengths, this isn't going to work for me. Can
    anyone tell me how to preserve my leading zeroes?

    If it makes a difference, I'm running on CFMX 6.1, and the original query is
    being created with QueryNew(), from an XML source.

    Thanks in advance.

    D. Miller Guest

  2. Similar Questions and Discussions

    1. Exporting database contents to Excel but missing leading zeroes???
      I have the following script working well for database exports to Excell. However, all my zip codes are missing the leading zeros (probably other...
    2. #40020 [NEW]: int values with leading zeroes
      From: pav at oook dot cz Operating system: FreeBSD PHP version: 5.2.0 PHP Bug Type: SOAP related Bug description: int...
    3. #40020 [Opn->Bgs]: int values with leading zeroes
      ID: 40020 Updated by: tony2001@php.net Reported By: pav at oook dot cz -Status: Open +Status: Bogus...
    4. Leading zeroes
      Hello, How can I suppress the leading zeroes, except one when all positions are 0; for example: 000015 will be 15 000000 will be 0 thank...
    5. leading zeroes in day, month
      Hello! I would like to show day(date) and month(date) with leading zeroes. Is it any way to do that Mitja
  3. #2

    Default Re: Preserving leading zeroes in a query

    Basically, you have to force the field to be text. Make sure the first row is
    strictly alpha. Since you are building your own, do something like this:

    create the query variable
    populate the first row with something that will force that fields to be text.
    loop through your file and add the real data.

    Then in your QofQ, add
    and that_file <> 'what you put in that field'
    to your where clause.

    Dan Bracuk Guest

  4. #3

    Default Re: Preserving leading zeroes in a query

    Thanks, Dan. I ended up adding an "x" in front of the zeroes, then removing it when displaying the link.

    Thanks!
    D. Miller 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