Questions tagged [auto-increment]

a database constraint that automatically increases from the last record when making an INSERT

AUTO_INCREMENT is a flag set on a field in a database table that forces the RDBMS to create a unique identifier for the record. This is useful when no other obvious primary key field is apparent in a record.

Useful questions

Related tags

2677 questions
1
vote
2 answers

Creating incrementing numbers with mongoDB

We have an order system where every order has an id. For accounting purposes we need a way to generate invoices with incremening numbers. What is the best way to do this without using an sql database? We are using node to implement the application.
Thomaschaaf
  • 17,847
  • 32
  • 94
  • 128
1
vote
2 answers

Creating a .NET incrementing assembly build version in Git

How do I write a script which will create a source file containing the version number? I would like the build number (4th number in the version quadruple) to be autoincremented for each commit. I found some examples on how to use bash commands to do…
Lou
  • 4,244
  • 3
  • 33
  • 72
1
vote
3 answers

SQL Server AutoIncrement varying by value of another field

Using SQL Server 2008 R2 I'd like to have a table (already having a primary key on 2 columns) with a third column which is an autoincrement based on one of the two columns part of the primary key. In other terms, I would like when adding a new…
eddo
  • 2,094
  • 1
  • 25
  • 31
1
vote
1 answer

Rails Rake MySql Autoincrement Problem w db:fixtures:load

I'm trying to load some Rake Fixtures (rake db:fixtures:load) into a MySql database and I'm seeing some weird behaviour with AutoIncrement values. Normally this goes up by 1 for each insert which allows me to define/create tests. (BTW - normal…
BrendanC
  • 463
  • 1
  • 7
  • 18
1
vote
6 answers

How to generate dynamic id of
  • ?
  • I have one div which contain UL and LI. In this I want to generate dynamic IDs of that LI. Right now I have used static HTML:
    wasim kazi
    • 378
    • 4
    • 13
    1
    vote
    3 answers

    How to make application auto-increment id in SQL Server Compact 3.5?

    I've set up a SQL Server Compact 3.5 database in my WinForm application. I set my ID identity to true so that when the user adds to the database it will automatically give it an ID and automatically increment it. However, for some reason after the…
    Pallas
    • 1,499
    • 5
    • 25
    • 57
    1
    vote
    2 answers

    Auto increment in excel for alternative cell?

    Please check the eg. row - value 1 - test1 2 - test1 3 - test2 4 - test2 5 - test3 6 - test3 Like this automatically have to increment in MS-Excel without using any scripts Please give me a suggestion Thanks in advance
    user1551697
    • 21
    • 1
    • 3
    1
    vote
    6 answers

    mysql auto-increment - reassign after a record has been deleted

    I'm using auto-increment to assign a id to every new entry in my database. Also, i've got a php-script which is selecting 10 entrys from this database, according to the current pagenumber. For example, if the current page is 2, the script should…
    Wottensprels
    • 3,307
    • 2
    • 29
    • 38
    1
    vote
    3 answers

    MySQL: Auto increment minus one?

    I have some code that will delete a post from the database: mysql_query("DELETE FROM `posts` WHERE ID = '$id'"); Now I want to set the auto increment minus one to keep up with the deleted post. Is this possible? If so, how can I do it? Thanks!
    SnarkyDTheman
    • 255
    • 3
    • 7
    • 17
    1
    vote
    2 answers

    SQL Server Auto-Increment Next INSERT Query

    I have a good background in MySQL, but I am new to the ins and outs of SQL Server. I'll ask my question by setting up and solving the exact same issue in MySQL: Create table: CREATE TABLE IF NOT EXISTS `example` ( `id` int(10) NOT NULL…
    Oliver Spryn
    • 16,871
    • 33
    • 101
    • 195
    1
    vote
    1 answer

    Coldfusion: QueryNew and auto increment?

    Is there a possiblity to add the "auto_increment" attribute to QueryNew() in Coldfusion? I want to simulate a database, so I need a primary key, which I refer to. My goal is an easy navigation with nav_id and nav_pid (parent id). If there is no easy…
    Dollique
    • 952
    • 2
    • 10
    • 29
    1
    vote
    2 answers

    insert if not exist , using auto incremental primary keys. mvc3

    i have a problem with auto incremental primary keys.. when im adding a student to my database, i can add the same student over and over again because the primary key of student is auto incremental so it is, of course, never repeated, i need to…
    user1462933
    • 1,179
    • 2
    • 12
    • 24
    1
    vote
    1 answer

    JPA primary key generation using TABLE GenerationType, not generating sequential values, why?

    I am using the TABLE GenerationType strategy for generating primary key values of a table. The starting value is 0 so I am expecting that the id values of the new rows added to the database will be sequential, i.e. 1 then 2 then 3 then 4 ...…
    Rami
    • 8,044
    • 18
    • 66
    • 108
    1
    vote
    1 answer

    get last id from table#1 to determen new ID on table#2

    I have an old registration system, and a new one. (two tables). The old system holds an old category, and the new one holds some new categories that couldn't be implemented into the old system just yet. So moving everything to one of the systems is…
    ThomasK
    • 2,210
    • 3
    • 26
    • 35
    1
    vote
    5 answers

    MYSQL copy row to another identical table with AUTO_INCREMENT id field

    I have a movie database where movies are inserted into a table named titles with an AUTO_INCREMENT primary key named titles_id. Users can submit movies anonymously which are inserted into a separate identical table named titles_anon. After reviewing…
    Kratos
    • 37
    • 1
    • 4