Best Method?: For Resetting sequential numbering . .. . .

Ask a Question related to Macromedia ColdFusion, Design and Development.

  1. #1

    Default Re: Best Method?: For Resetting sequential numbering . .. . .

    Hi Leonard,

    I don't know about mysql but the ms access help (search autonumber) gives a
    detailed instruction on how to do this. But basically you need to delete the
    autonumber column and add a new one.

    I see major problems with this if there are other tables joined by this
    autonumber column.

    Why do you need to do this ? I can see no valid reason for this as the
    autonumber column is to establish a key field to identify the record.

    Ken

    The ScareCrow Guest

  2. Similar Questions and Discussions

    1. DataBinding to a Sequential File
      I am new to vb.net and I am running into problems understanding DataBinding and its concept. The only examples I find are always talk about Web...
    2. sequential functions?
      I'm trying to make one function go right after another function finishes. For example, say I have an EaseTo function (which would make an MC ease to...
    3. Create Sequential Numbers
      I have an imported database with a number field which is now empty. I would like to populate this field with sequential numbers to use for...
    4. File names with sequential numbering
      I have been sent a large number of files with descriptive file names. I would like to rename these files with a filename of "Prefix + sequential...
    5. sequential loss in jpeg
      I understand that every time you open a jpg file in photoshop and resave it as a jpg, you lose more and more data. But what about copying files? When...
  3. #2

    Default Re: Best Method?: For Resetting sequential numbering . .. . .

    Hi Ken -

    Thanks for your response. I will try to answer your questions.

    This project is for a public service entity. As with most entities they log
    their incident reports
    with a sequential number, which starts off at one (1) for at the beginning of
    each year.

    Ex: Incident Number 05-123, 05-124, 05-125

    I totally agree with you, in messing with the autonumber field could lead to a
    major
    problem down the road and it is not my intent to do so. Perhaps I was not
    clear on that
    point of things.

    If all can be done, there would a separate field to contain the actual
    incident number,
    which is the one that would be incremented, regardless of what happens to the
    autonumber field. It is this additional field that I would like to reset to
    zero at the start
    of a new year.

    Example:

    RecordID / IncNum / Title
    1 / 1 / Title 1
    2 / 2 / Title 2 <--- Year Ends
    3 / 1 / Title 1 <--- Year Starts
    4 / 2 / Title 2

    And so on.

    I hope this answered your question.

    Thanks -

    Leonard B







    Leonard B Guest

  4. #3

    Default Re: Best Method?: For Resetting sequential numbering . .. . .

    a fairly common way of doing this in a portable manner is to use another table
    to handle the sequential number. if the db is trigger capable a simple update
    would update the sequence and return it to the calling app. if not then it
    bcomes a bit more complex. if the db is capable, you could schedule a
    procedure/script to zero that out every jan-1, if it's not capable then do it
    via cf's scheduling.


    PaulH Guest

  5. #4

    Default Re: Best Method?: For Resetting sequential numbering . .. . .

    While Paul has given a couple of options, I'm going to add another but it is
    base on an assumption.

    The id number appears to have the year prepended to it. If this is correct
    then you could do the following
    Also I assume that you have a standard autonum column in the table.

    When you need to insert a new record

    Select the max standard autonum column, this should then give you the maximum
    incident number (although you could create a query solely on this column to
    select the max number after the "-")

    Then to create this incident number, just check if the year(now) is the same
    as the first bit of the column (before the "-")
    If it is, just increment the integer (part after the "-")
    If its not (which should only happen once) then it's a new year, start from
    one (1)

    I might not have explained this correctly, but I can see it in my head. So if
    you rerquire more info let me know.

    Ken

    The ScareCrow Guest

  6. #5

    Default Re: Best Method?: For Resetting sequential numbering . .. . .

    Greetings -

    I took imput from both of you guys (Ken and Paul), and found a solution to the situation.

    Thanks guys for the input, got me on track.

    Leonard B
    Leonard B 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