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
3 answers

Practical issue with MYSQL auto incremented primary keys

I have written an accounting module for my java app recently. The module is based on MYSQL tables and INNODB Engine. one of the requirements is of course a "running" ID for each invoice. I tried to generate the id using the auto_increment method…
Vova
  • 160
  • 2
  • 12
1
vote
1 answer

Auto-incrementing attribute with custom logic in SQLAlchemy

I have a simple "Invoices" class with a "Number" attribute that has to be assigned by the application when the user saves an invoice. There are some constraints: 1) the application is a (thin) client-server one, so whatever assigns the number must…
Joril
  • 19,961
  • 13
  • 71
  • 88
1
vote
2 answers

App Engine datastore: ID auto increment with NDB

I'm modelling data, which IDs should be with auto increment. Actually, I've made working model, but need some advise from datastore guru. There is my code for ID generation: class AutoIncrementModel(ndb.Model): entity_id =…
TipTop
  • 143
  • 1
  • 2
  • 9
1
vote
2 answers

Adding incrementing numbers to select box name attr on duplication in jquery

I am taking the amount from one select box and duplicating a div that number of times. But I have run into a problem. I need the new divs (which contain select boxes) to change their name. I need it to add the incrementing number to the end of the…
luv2code
  • 1,216
  • 6
  • 22
  • 42
1
vote
2 answers

Copy a file to a new location and increment filename, python

I am trying to: Loop through a bunch of files makes some changes Copy the old file to a sub directory. Here's the kicker I don't want to overwrite the file in the new directory if it already exists. (e.g. if "Filename.mxd" already exists, then copy…
Mike
  • 4,099
  • 17
  • 61
  • 83
0
votes
1 answer

Autoincrement in couchdb

I'm trying to write a web application using nodejs and couchdb. In couch i store content of my seperates page. What is my problem.. i would have a nice urls like…
Kim Yu
  • 205
  • 2
  • 9
0
votes
1 answer

ASP.NET - VB.NET input into MS-ACCESS with autoincrement

I have an ms-access database called db.mdb and it contains various table. I;m creating a Account Creation page with ASP.NET and VB.NET. I'm trying to input fields within the page into ms-acess db but when I open the db there are no values entered…
Brian
  • 1,951
  • 16
  • 56
  • 101
0
votes
2 answers

return id from database after insert

i have a php that responds to an ajax and inserts a row into database, this is the code if($action == "insertCalendarEvents") { $calendar_group = $_GET["calendar_group"]; $event_name = "'" . $_GET["event_name"] . "'"; …
Pacuraru Daniel
  • 1,207
  • 9
  • 30
  • 56
0
votes
1 answer

Gnuplot incremental filename using macro

Hell, I need to plot points out of my c++ application. So I simply save my points to a points.txt and then run system("gnuplot 'plotmakro'"); which contains: set output 'plot.png' set terminal png set grid set multiplot plot pointsa.txt' ',…
Tobias
  • 7,282
  • 6
  • 63
  • 85
0
votes
2 answers

How to obtain with PHP the last ID inserted if my primary key does not autoincrement

I have a table in MySQL that for compatibility issues we assigned specific Primary Keys, therefore they can not be auto incremented. Every time we insert a new topple (in PHP) we need to get back the latest ID inserted. It might sound stupid. but we…
multimediaxp
  • 9,348
  • 13
  • 49
  • 80
0
votes
2 answers

How can I create nested AUTO_INCREMENT fields in a table with MySQL?

As part of the management application we're making, I'm trying to optimize as much PHP and MySQL code I can, but I have a concern... Actually, our data scheme for storing a client order is the following: year -> DATE order_id ->…
Julio María Meca Hansen
  • 1,303
  • 1
  • 17
  • 37
0
votes
2 answers

What causes duplicate PKs in MySQL?

I encountered this quite a few times so far, but still don't understand it (my MySQL internals skills are equal to none). I know it's probably a PEBKAC but trying to replicate the behavior manually ends up with an error (autoincrement). CREATE…
Kemo
  • 6,942
  • 3
  • 32
  • 39
0
votes
1 answer

Should I create a parent table for shared attributes?

I am designing the database (MySQL) in which I have two tables Employees and Guests as following : CREATE TABLE employee ( `EMP_ID` INT UNSIGNED NOT NULL AUTO_INCREMENT, `FIRST_NAME` VARCHAR(8) NOT NULL, `MID_NAME` VARCHAR(11), `LAST_NAME`…
Sasha
  • 29
  • 1
  • 2
  • 8
0
votes
2 answers

How can I make a primary key as AUTOINCREMENT in vb.net 2008?

I have table in a DB and the primary key is the 'TID' column, and I want to make it as AUTOINCREMENT, but I can't, because the "Identity specification" is turned off! See this picture: http://www.rofof.com/img2/6xsbuy6.gif How can I do it? Thanks!
turki2009
0
votes
3 answers

Make one ID with auto_increment depending on another ID - possible?

I want to make a small ticket-system for a project server which has several projects. So far the TicketID will be counted globally, i.e. there is a project A and a ticket with TicketID 1 and another project B and the ticket for this project will get…
Thomas Jacob