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
0
votes
1 answer

Auto increment in table (database)

I tried make a Tasks table, very frequent adding/removing items. When the application live, the table used for storing queued task and dequeued it. When the app interrupted (restarted), the next app lifecycle continues working incomplete tasks, and…
Heyyy Marco
  • 633
  • 1
  • 12
  • 22
0
votes
2 answers

Copy table from one data connection and paste into database in another data connection in visual studio

This may be super obvious, but I can't see it. I have a table I created in SQL Server Management Studio. I had to create it there because I needed to use a function for an alpha-numeric ID column that increments itself. I then exported the table,…
NJohns
  • 37
  • 1
  • 1
  • 6
0
votes
1 answer

CakePHP. How can i make a model test in a table with another primary key?

I have this table CREATE TABLE myexamples.problems ( id INT, name VARCHAR(45) NULL , pk_id INT AUTO_INCREMENT PRIMARY KEY ); But when I try test a model in cakephp, it fails because the table has two autoincrement attributes. The following…
user542233
0
votes
3 answers

Android SQLite dilemma

I want to increase my integer primary key by 1 for every new entry in a specific table. I read that i could do that by using AUTOINCREMENT. On the other hand i found the note below: Note that "monotonically increasing" does not imply that the ROWID…
JustCurious
  • 1,848
  • 3
  • 30
  • 57
0
votes
3 answers

mysql how do I change the column id from varchars to ints and autoincreasing?

How do I make the change of the column ID in the table to ints and auto-increment through phpmyadmin? Thanks
merrill
  • 593
  • 5
  • 14
  • 34
0
votes
1 answer

MySQL: can AUTO_INCREMENT=some_value; be voided when create a table and insert rows?

I've just converted MYISAM into InnoDB. Before doing that, I've saved the table (see the code below, that was created automatically by phpMyAdmin), dropped it, changed the engine to InnoDB and created it again. CREATE TABLE IF NOT EXISTS `orders` ( …
Haradzieniec
  • 9,086
  • 31
  • 117
  • 212
0
votes
3 answers

Unique Identifier Mixed Format with Date Prefix (Php / MySQL)

I am creating a ticketing system that will keep track of tickets that a customer creates. The ticket's basic information will be stored in a table 'tickets' who's structure is as follows: Primary Key (int 255) Ticket_Key (varchar) Ticket…
0
votes
1 answer

I want to add Auto_Increment to the first column in my table

How do I add the Auto_Increment property to the first column in my table ? This is what I tried but it does not work: "ALTER TABLE `User_ReputationLog` MODIFY `EntryID` int(11) AUTO_INCREMENT;"
rolling_codes
  • 15,174
  • 22
  • 76
  • 112
0
votes
5 answers

How to find next free unique 4-digit number

In my db application I have a requirement for a unique, 4-digit number field for each customer. Up until 9999 I can just use autoincrements, but after that I will have to reuse numbers of customers that have been deleted (there won't be more than…
chiborg
  • 26,978
  • 14
  • 97
  • 115
0
votes
1 answer

Generating primary keys in symfony2 and mysql

How to automatically generate a primary key in Symfony2/Doctrine2 ? I have all my entities and database made. In my Symfony2 controller, I do :
Creasixtine
  • 740
  • 3
  • 11
  • 33
0
votes
2 answers

auto_increment field and other primary key in table

i have a table with primary key defined (post_id,category_id).his table implement Many_Many relation. how to add a autoincrement field to this table (i usually use auto_increment field to easily fetch records and use auto_increment value in form).…
user006779
  • 1,011
  • 4
  • 15
  • 28
0
votes
1 answer

Faking Auto Increment Increment on a Table in MySQL Using Trigger

I have a content table in my MySQL database (a Drupal content table, for what it's worth), which has an auto incremented primary key, nid. I want to be able to implement an odd and even id solution, where content created on production has even ids…
Isaac
  • 1,505
  • 15
  • 8
0
votes
1 answer

MySql InnoDb auto-increment pre-fetching values

How do I get future keys from a Mysql InnoDb? Oracle and Postgres both have the concept of sequences and a nextval-function. Mysql seems to be a bit different. Is there some easy sql statement to pull maybe 1000 future keys for a certain…
Franz Kafka
  • 10,623
  • 20
  • 93
  • 149
0
votes
1 answer

Auto incrementing does not occur when adding an item in PostgreSQL using Hibernate

I created a table in PostgeSQL with data for a person and marked the column "id" with the type 'SERIAL' as 'primary key', 'not null' CREATE Script: CREATE TABLE people ( id serial NOT NULL, name varchar(15), surname varchar(25), department…