368 questions
1
vote
1
answer
78
views
EF Core: how to handle an entity without a database-generated key?
In Entity Framework Core 7, I have the following entity:
[Index(nameof(Time))]
[Table("DataEntries")]
public class DataEntry
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]...
1
vote
1
answer
90
views
Cannot insert explicit value for identity column in table 'Products Discussed' when IDENTITY_INSERT is set to OFF
I get the error mentioned in the title.
Important
The form submits the data into the database successfully, but then it tries to submit again with another query that tries to simultaneously insert a ...
0
votes
1
answer
32
views
How to move up ID in autoincrement column Oracle SQL Developer
Now the highest ID in ID column is 192409. I need Oracle to start adding new values from number 192734 (I want to values between 192409 and 192734 will be empty).
How can I do this?
This is how this ...
0
votes
3
answers
4k
views
How do I correctly set the GENERATED BY DEFAULT AS IDENTITY sequence after inserting manual ids?
I have a table with a primary key sequence using the newer GENERATED BY DEFAULT AS IDENTITY feature:
CREATE TABLE test (
id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
data VARCHAR
);
I ...
0
votes
1
answer
83
views
Getting generated value from Identity Column in EF Core 7
I still get zero as response on my Edentity Column after SaveChangesAsync().
Here's my entity
public class Person
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
...
0
votes
1
answer
729
views
Why do I get a foreign key not unique error on an identity column?
If I try to create two tables like this in PostgreSQL 14.3:
CREATE TABLE IF NOT EXISTS foo (
id INT4 GENERATED BY DEFAULT AS IDENTITY (INCREMENT BY 1 MINVALUE -2147483648 START -2147483648),
foo ...
1
vote
2
answers
13k
views
Postgres auto increment primary key
I am trying to work out how an auto increment key is represented in Postgres, depending on whether you create it using the SERIAL type or using an IDENTITY.
When I create a table with a SERIAL primary ...
1
vote
1
answer
43
views
how do I go about ensuring that the recently generated id is returned when we insert a record via a PostgreSQL View's trigger's function?
Here is info about our technical development environment :
PostgreSQL 14.2, compiled by Visual C++ build 1914, 64-bit
Here are the various code snippets associated with the various database objects in ...
1
vote
2
answers
850
views
Azure Synapse IDENTITY COLUMN; Wrong Id values based on seed
The goal is to create a table, insert some (3) dummy rows for technical reasons, then for any valid data, start using Ids above 100.
Script for creating (drop-create) the table:
IF OBJECT_ID(N'dbo....
1
vote
2
answers
3k
views
When should I use SET IDENTITY_INSERT <tablename> OFF function?
To insert values into the identity column manually, I use:
SET identity_insert product ON
INSERT INTO product (PID, ProdName, Qty, Unitprice)
VALUES (10, 'soap', 5400, 22)
Firstly I have deleted ...
0
votes
0
answers
61
views
DbCommand.ExecuteScalar() on multiple queries freezes with Sybase
I'm working with a legacy Sybase database, on a table that has an Identity column. When inserting a value into the table, I need to retrieve the new identity value.
I've been picking up ideas here and ...
0
votes
1
answer
2k
views
REST API inserting into a table with 'GENERATED ALWAYS' column
I'm using Oracle's Autonomous Database service, with ORDS providing the REST functionality.
When making updates to a table (docs here), when I have an identity column id that is GENERATED ALWAYS, it ...
3
votes
1
answer
4k
views
Turn ON OFF IDENTITY INSERT equivalent in Oracle
I have the following ProductCategory dimension in my DWH design to not lose data :
ProductSK ProductID ProductName BI_StartDate BI_EndDate
-1 -1 Undefined 99991231 99991231
The ...
4
votes
2
answers
1k
views
Insert multiple fields with identity column doesn't work
I might be overworked today, but I am not getting this situation. It has to be something silly that I am simply overlooking.
The table structure is as follows:
CREATE TABLE sample_table (
id int8 ...
0
votes
1
answer
140
views
SQL Server Identity column inserts
I support a data replication product. I have a client who is very frustrated that SQL Server can't have a table with an Identity column that BOTH increments automatically when a row is added without ...