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

Add an item to SQL and get auto incrementing id back immediately

I'm using the following code to add a entry to my SQL database. $RQ1_string = "INSERT INTO automotive_RQ01_Information VALUES(NULL,'".$title."','".$description."')"; $RQ1_result = mysql_query($RQ1_string); In the next line I need to use the value…
Philip Kirkbride
  • 21,381
  • 38
  • 125
  • 225
0
votes
0 answers

Auto incremented value not persist in persistent object after transaction commit until session closed

I have Entity with generated "Id" as well as another attribute call "code" with auto incremented value. After call session.persist(entity) and transaction.commit() the value of "code" in persistant object is null event the DB get updated with value…
SLMORA
  • 21
  • 2
0
votes
1 answer

How to transition an existing DB Schema without AUTO_INCREMENT primary key to a key with AUTO_INCREMENT?

I have an application which was developed with HSQL DB and the problem is that we are migrating it to MySQL with JPA/Hibernate. The problem is that the old schema doesn't have an AUTO_INCREMENT primary key : how can I use JPA to use such an…
kaffein
  • 1,766
  • 2
  • 28
  • 54
0
votes
1 answer

How to automatically increment Django IntegerField

I have a field in my model Step=models.IntegerField() I call it normally in the template with the following: {{user.step}} Now I want this field to automatically increase after every year What is the best approach here?
0
votes
0 answers

auto increment of number in terraform

actually i am trying to provision ec2 instance from ServiceNow catalog through terraform script. when provisioned the ec2 instance the name will be something be like abc001A , second time when trying to provision ec2 using i want the name will be…
0
votes
0 answers

Change ID in MySQL table permanently

How can I change the value of the ID in a MySQL table, for example, to "9999," while keeping the remaining IDs (1-315) unchanged and ensuring that the next autoincrement value is actually set to "316" and not "10000"? First I made this…
0
votes
0 answers

PHP file_put_contents() make a primary key that auto_increments

this is my first time asking a question since I cant find any better solutions for my problem. I got a task to make a form by website that uses file_put_contents() for book data library. My code contains:
0
votes
0 answers

Ms access database has skipped an auto increment number (ID) after repare. How to restore it?

I have Microsoft access database. I have about 1200 records, with attached documents through forms and am generating several reports with it. While doing data entry access just halted and I restarted. Then it said repair is required and…
0
votes
1 answer

Add incremented variable in jquery ajax success handler

I want to increment the value of a variable ii, but its value does not change. If I move ii++; before the alert function call, it increases but the value set to #spanstatus is always 0. How do I increment the value of ii, and still access it before…
Hida
  • 154
  • 10
0
votes
1 answer

Entity Framework trying to add null primary key with auto increment

I'm starting a new Blazor project using Entity Framework 7 and an existing database. I created a class refering to a existing table from my database. public class IEA_EtatsDemandes { public IEA_EtatsDemandes() { } [Key] public int…
Valter
  • 63
  • 9
0
votes
1 answer

MySQL - Single auto increment with multiple primary keys or a safe way for insert with max()+1 in MySQL

I am looking for a solution two have my second primary key column to be auto incremented depending on the first primary key. Think about the following example case to comprehend the aspects of my goal: An orderItems table where order_id (INT) and…
Sercan Samet Savran
  • 755
  • 1
  • 9
  • 20
0
votes
0 answers

How do I import posts into a new wordpress site if post ID starts at 26?

I want to use the WordPress export tool to export my posts from an old site. My concern is that the post ID in the old db starts at 26 and the destination database which is a fresh install obviously starts at 1. The old db starts at 26 because I had…
MohsinG
  • 121
  • 2
  • 11
0
votes
1 answer

How to keep the auto-increment function (in SQL IDENTITY) for ID after importing from Access to SQL Server?

I'm importing tables from Access to SQL Server. The column ID in Access is auto-increment, but in SQL Server I must enter every time the ID. It's important to say that there're records in the imported tables and I want to alter the ID be IDENTITY. I…
zaraboy
  • 11
  • 3
0
votes
1 answer

Auto increment by group mariaDB

I have this MariaDB table. id order name forum_id 1 1 .... 1 2 2 .... 1 3 3 .... 1 4 1 .... 2 5 2 .... 2 where id is PK. order is the user given numbers to arrange…
aoz
  • 9
  • 2
0
votes
3 answers

Stopping increment at specific height

I am animating images within a logo in a slot-machine type of animation. I need it to stop animating once it gets to the top of the image (and send a callback if possible). Currently, this is how I'm accomplishing the…
Alexander
  • 49
  • 1
  • 1
  • 7