Note that there are some explanatory texts on larger screens.

plurals
  1. POAuto-increment Using Dates
    primarykey
    data
    text
    <p>I'm quite a beginner in general but I have a theory, idea, etc...</p> <p>I want to create a task database, with a unique TaskID column [primary key or not] using the date. I need the entry to be auto-generated. In order to avoid collisions, I want to attach a number to the end, so this should achieve the goal of having all entries unique. So a series of entries would look like this:</p> <p>201309281 [2013-09-28]</p> <p>201309282</p> <p>201309291</p> <p>My thought is that I could use auto-increment that would reset at midnight EST, and start again at the given date, or something like that.</p> <p>The advantage, to me, of having it work like this, is that you could see all tasks created on a given day, but then the particular task may not be completed or invoiced until, say, a week later. This way you could search by creation date, completion date, or invoice date.</p> <p>I realize that there are many ways to achieve the end goal of task database. I was just curious if this was possible, or if anyone had any thoughts on how to implement it as the primary key column, or any other column for that matter.</p> <p>I also want to apologize if this question is unclear. I will try to sum up here. Can you have an auto-increment column based on the date the row is created, so it automatically generates the date as a number [20130929] with an extra digit on the end in the following format, AND have that extra digit number on the end reset to "1" every day at midnight EST or UTC? And thoughts on how to accomplish?</p> <p>eg: 201309291</p> <p>EDIT: BTW, I would like to use an MVC4 web app to give users CRUD functionality. Using C#. I thought this fact may expand the options.</p> <p>EDIT: I found this q/a on stack, and it seems similar, but doesn't quite answer my question. My thought is posting the link here might help find an answer. <a href="https://stackoverflow.com/questions/2025236/resetting-auto-increment-column-back-to-0-daily">Resetting auto-increment column back to 0 daily</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload