Questions tagged [auto-increment]
a database constraint that automatically increases from the last record when making an INSERT
2,581
questions
0
votes
0
answers
16
views
create sqlite table with autoincremental column with custom start and step value
i googled around with no luck. Is it possible in Sqlite to create a table with autoincrement column which starts at -1 and each new row will decrement by 1, so the first few rows will have -1, -2, -3, ...
0
votes
2
answers
85
views
Can't create int-autoincrement primary key on sqlite using EF Core
I'm trying to create a simple table where the primary key is an autoincrementing integer.
So what I did is, create that .NET class and tried to create the migration.
this is the class-entity:
public ...
0
votes
1
answer
35
views
How I can use an auto increment in java for a register system? [closed]
I'm creating a register system for students using files, while I use the program the auto increment works fine, but when I ruin it again, the autoincremnt returns 1, also I am not allowed to use ...
0
votes
0
answers
60
views
UUID and auto increment INT as primay key for diffrent tables in one db
I have a database with about 100 tables, I want to add REST API requests connected with some tables. I don't want to expose id from the database directly to the request so I want to change PK (primary ...
0
votes
0
answers
10
views
auto filling varchar column in MySQL [duplicate]
StudentID
Name
stu001
Ann
stu002
James
I want to create a table with auto filling StudentID column (it's a varchar column).
I found various methods to use identity in SQL Server. but I couldn't ...
0
votes
1
answer
71
views
JHipster 7: Database errors: Duplicate ID entry error
Recently, a JHipster 7.7.0 application started generating server side/database errors for ALL tables. The application was deployed in production, and users entered data without problem. Suppose ...
0
votes
0
answers
17
views
Exclude AUTO_INCREMENT column value while using Entity framework Clone SetValues methods
I am using below code to clone records from one table to another using Entity Framework
List<MasterTableRecord> _records = context.MasterTableRecords
....
-1
votes
1
answer
51
views
How to auto-increment in posgresql?
i have a star schema datawarehouse i did the load with python and i set the id of the employee = id in the database , ron has id number = 99 , Tom =201 ,Alice =87 but in the database i found the id ...
0
votes
0
answers
50
views
Data migration using hibernate - Primary Key problem (how to set pk if generationtype = identity)
I am migrating data from an existing ms sql server to mysql (and use the data from there on...)
The application is a spring boot app using hibernate and jpa for all the cool stuff...
The primary keys ...
0
votes
1
answer
46
views
How to Prevent Reuse of Deleted Primary Key Values in Table?
I have a table with the primary key set to auto increment. Sometimes, records get deleted. When this happens, I DO NOT want to reuse the deleted 'recID' values ... but that's what happens!
For ...
0
votes
2
answers
74
views
How to generate auto increment in a folder in python?
I am new to Python. Anyone help with how to generate auto-increment like B00001, B00002, B00003...... which can autosave the excel file name with a button in a specific folder.
I have tried with
...
0
votes
1
answer
113
views
How to not increment sequence when conflict of insert occurs
When a conflict occurs on insert into a table with an auto incrementing id column, the sequence gets bumped causing a gap in the id range, which for me is undesirable.
Here is a simplified version of ...
0
votes
1
answer
35
views
Auto-increment field based on duplicate values of other fields [duplicate]
I have a dataframe like so:
df <- data.frame(
COL1 = rep("28", 10),
COL2 = c(rep("33", 6), rep("45", 4)),
COL3 = c("10", "10", &...
0
votes
0
answers
17
views
Auto Increment when copy/paste row
I have Apps script (Google Sheet) formula which copy/paste selected row but I'd like to add a function which can auto increment value in the copied column. For example in original row, ColB I have ...
0
votes
2
answers
79
views
How can I make a set of numbers that increase every 30 seconds to line up in an ascending order?
If you run this javascript code below,
var i = 20220215155;
function increment(){
i++;
document.getElementById('period').innerHTML += i + "<br />" + "<hr />&...
0
votes
1
answer
28
views
autoincrement number function-postgres
i have a table like this:
id
person
20
adams
20
george
40
jina
46
rico
80
naya
90
john
90
peter
90
richard
i want to find a way to select a new_id starting from 1 and increazing +1 every ...
1
vote
1
answer
26
views
MySQL query id generation
I have table and when I add a new row I want to calculat an id number to it.
conditions:
if i have missing number give the smallest one (3)
if i have no missing number than give the next number that ...
0
votes
0
answers
211
views
How to properly use Gorm auto increment?
I have a Go struct that defines a table managed by gorm. It includes a unique, integer, primary key that auto increments.
type CreatedSurvey struct {
...
Id int `json:"id" gorm:&...
0
votes
2
answers
113
views
PSQL throwing error: relation "serial" does not exist, when creating a table
It happens when i run this code:
CREATE TABLE distributors (
did integer PRIMARY KEY DEFAULT nextval('serial'),
name varchar(40) NOT NULL CHECK (name <> '')
);
I have tried remover the ...
0
votes
1
answer
91
views
Error while creating database table with auto increment [closed]
I want to make auto increment here with the table creation but it gives an error. The database is an oracle database. The SQL is shown below.
CREATE TABLE Continents
(
ConId INT ...
0
votes
0
answers
37
views
Java + JPA + HIBERNATE / AutoCreating entity in database
I try use data.sql.
I don't understand why i have exception: "table not found"
if I delete file data.sql, autocreate start work and i have all Tables in database, but i want add entity when ...
0
votes
1
answer
29
views
bad autoincrementation when copying tables in mysql
I have two tables in my databaes: original_db and archive_db.
in original_db I have two cols:
id (auto-increment)
name
in archive_db I have three cols:
id (auto-increment)
user_id
name
I want to ...
0
votes
0
answers
18
views
auto_increment countdown on MariaDB
I have a DB where every day I add 300 register of the sale information (total more than 100,000 and incremented). Just de last sales information is relevant. The query is like this:
SELECT a.ID, a....
0
votes
1
answer
113
views
Update every row with an incremental value in Mysql
Using the following query i tried to populate the empty values of a column, with an incremental number, based on the last row.
select @i := (
SELECT code
FROM products
WHERE code <&...
0
votes
1
answer
37
views
Mysql Irregular Auto_Increment increment
The table is as follows. Interestingly, the 'id' column with Auto_Increment is increasing irregularly and high.
SELECT * FROM `numbers_api` ORDER BY `id` DESC
id | email | ...
0
votes
0
answers
110
views
Pointer increment in array struct in C
I'm currently trying to do project that consists of creating a program that helps to manage a fleet of eletric vehicles. In this program, the fleet can only have a maximum of 10 vehicles. These ...
0
votes
1
answer
29
views
trying to autoincrement primarykey using trigger in flask and storing in sqlplus oracle 10g
'''@app.route("/indexf",methods=["POST","GET"])
def signup():
conn=cx_Oracle.connect(user="SYSTEM",password="bnm")
cur= conn.cursor()
...
0
votes
2
answers
203
views
PGAdmin CREATE script sequence relation does not exist
I've been creating tables with PGAdmin and I've got a field that I want to auto-inc, and PGAdmin will create a sequence. Then I'll want to edit the table in some fashion so I pull up the CREATE script ...
-1
votes
1
answer
49
views
Mariadb auto_increment different series for another column
I'd like to create a table something like.
CREATE TABLE `testing` (
`prefix` tinyint(3) unsigned NOT NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`,`prefix`) USING BTREE
)...
3
votes
2
answers
491
views
How to generate Unique, AutoIncremented Id using Hibernate/Spring JPA for Snowflake table?
I am quite a newbie at Snowflake and instead of implementing the Snowflake JDBCDriver, we decided to use the Hibernate/Spring-Data JPA for that as that was more convenient to use. We came through this ...
0
votes
1
answer
70
views
Incremental load from Sharepoint List to Azure SQL Warehouse
I want to do incremental load from Sharepoint List to Azure SQL Warehouse using ADF. Is it possible or not?
0
votes
1
answer
68
views
Each instance of class 'Worker' should have an own id, starting at 1 and get incremented everytime (1, 2, 3 and so on)
Question above. I have already tried this: https://stackoverflow.com/a/24305983/16707725 but it doesn't work for me. Classes seem not to be able to memorize values.
fun main() {
val worker = Worker(&...
0
votes
1
answer
12
views
Increment Numbers as String Values in Sheets
I am trying to increment numbers in Google Sheets as string values so I can use them in IDs, example: "JER_HIL_0000002561".
I know I can drag down the autofill in the corner of the cell, but ...
0
votes
1
answer
97
views
Golang: How to get LastInsertId from table with a create trigger?
Trying to get the AUTO_INCREMENT id from a table that has an INSERT/UPDATE trigger into a "changes" table. Initially my code was the standard pattern:
stmt, err := db.Prepare("INSERT ...
0
votes
1
answer
151
views
Entity Framework data insertion with nested object having auto increment primary keys with one request
I am just curious to see if anyone knows of a way to insert nested objects that have auto increment keys without having to insert object one at a time.
For example, let's say I have the following ...
0
votes
1
answer
30
views
Sequelize auto incerment generating null
Here is my model for sample
const Sequelize = require('sequelize')
const db = require('../DBconfig')
const SampleModel = db.define('sample',{
id:{
type: Sequelize.INTEGER,
...
1
vote
1
answer
304
views
How can I add new item with auto-increment key in DynamoDB with Spring Boot
I want to make the primary key in DynamoDB an AutoIncrement Key like SQL.
And after generating this, if there are missing items in sequence,(after deleting some items)
+--------+---------------+
| ...
1
vote
0
answers
93
views
The auto_increment value is less than the max ID in table?
I'm using Mysql 5.6.46.
And the final sql execute in my code is
REPLACE ... .
I'm using multi thread way to batch insert data into my db table.
The question is the AUTO_INCREMENT is less than my ...
0
votes
1
answer
116
views
How do I add Auto-Increment ID Column to a table generated from SQL Query? [duplicate]
I have a table generated from SQL Query itself. Now I need to add an auto incremental id column into this table.
Usual syntax to add auto incremental id column is-
ALTER TABLE *Table_Name* ADD id INT ...
0
votes
0
answers
43
views
Make an auto increment id that is rising individually for deferent employees
I have 2 tables:
create table employee
(
employee_am int primary key not null,
working_comp int,
employee_bio varchar(50),
certifications varchar(50),
distinctions varchar(50),
...
1
vote
1
answer
42
views
SNOWFLAKE Sequence Creation Issue
In SNOWFLAKE database, I was trying to create 2 sequences under same name but with case sensitive and for one sequence I was trying to increment by 1 and the other sequence I was trying to increment ...
1
vote
1
answer
136
views
disable/remove auto increment attribute in snowflake
the table i used is ,
create or replace table abc(id int autoincrement, name varchar,date_of_birth date, age number, ts timestamp_ntz);
I used the below query to remove auto increment attribute in ...
0
votes
1
answer
68
views
Excel Macro - Automate Filename
Solved thanks
I have macros that create export files for our data. We produce many files everyday so I am trying to fine tune a few things.
At the end of the macro, I would like to save the file as ....
0
votes
0
answers
27
views
Increment cell value of DataFrame using df.at[] += x not working [duplicate]
I want to create a dataframe like this:
Days 2014 2015 etc...
Sunday 46 44
Monday 5 1
Tuesday 3 0
Wednesday 2 0
Thursday ...
0
votes
1
answer
165
views
Data type "smallserial" in Postgres not highlighted in Visual Studio Code
I am new to postgres, and I am using Visual Studio Code IDE (version 1.62) to write my scripts.
While doing so, I am observing this strange behaviour where VS Code doesn't highlight the data type ...
0
votes
0
answers
15
views
Auto Populate Column In SQL [duplicate]
I Have 2 Columns
IDnumber
User Name
IDnumber is set to Auto_Increment So that it will be filled automatically starting from 10000 when a data is added
I want to Auto populate the column Username by ...
0
votes
1
answer
41
views
Given the output of `show variables like '%version%';`, how do I determine what syntax I should use? [duplicate]
I sometimes get strange SQL errors, which tell me to check my MySQL version, e.g.
mysql> CREATE TABLE city (
-> id int NOT NULL IDENTITY(1, 1),
-> city_name char(128) NOT ...
1
vote
1
answer
933
views
How to declare "nextval('testing_thing_thing_id_seq'::regclass)" as default value for column "thing_id" in postgres table "testing_thing"?
In my postgres db there is a table called testing_thing, which I can see (by running \d testing_thing in my psql prompt) it is defined as
Table "public....
0
votes
1
answer
166
views
pgAdmin primary key in a table does not automatically get an auto increment
how do I auto increment in pgAdmin in my table? I should be able to INSERT and create a new row but the error is telling me that my primary key is null. How do I make my primary key automatically ...
1
vote
1
answer
61
views
MySQL - changing AUTO_INCREMENT value on regular interval
We are doing following on regular interval (every 10 minutes) to spread out auto increment column value and also to make it slightly non guessable. This works as expected. However, I would like to ...