Questions tagged [unique-constraint]

Unique-constraint is an index that sets one or multiple fields to be unique in a data entity

1353 questions
0
votes
1 answer

Maximum Size of a Unique Constraint on DB2 9.7

I created a table: CREATE TABLE myTable ( id int GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1, NO CACHE)PRIMARY KEY, pcdurl varchar(2000) NOT NULL ) And I would like to make the pcdurl attribute a unique…
BPL
  • 277
  • 1
  • 3
  • 4
0
votes
1 answer

MySQL get next unique value without auto increment

I have an MySQL database (InnoDB) that I'm developing for tracking Work Orders at my organization. There are multiple 'sites', and each site has work order numbers starting at 100. WorkorderID SiteID SiteWorkorderNum 1 1 …
dangel
  • 7,238
  • 7
  • 48
  • 74
0
votes
1 answer

Entity Framework 4.0: when I try to save some changes with unique constraint I get an exception

Well, I am trying to save a tree in a database, so I am using the modified preorder tree traversal method. I have a table with the following columns: IDNode IDRootNode IDParentNode Left Right In my table, I have two unique constraints, (IDRoot,…
Álvaro García
  • 18,114
  • 30
  • 102
  • 193
0
votes
3 answers

Unique index key in multiple columns

I need to define unique index key in my table using SQL Server. For example: ID Contact1 Contact2 RelationType ------------------------------------------------------------------- 1 1 2 sister // 1 is the 2nd…
0
votes
1 answer

Oracle: Unique constraint violated exception but my data does not actually violate it

I am trying to insert some data from excel file into a table. I have two excel file as follows: Test2: 5/12/2012 5/18/2012 ABQ ANC 1 52 5/12/2012 5/18/2012 ABQ ANC 2 30 5/12/2012 5/18/2012 ABQ ANC 3 34 5/12/2012 5/18/2012 ABQ…
Susie
  • 5,038
  • 10
  • 53
  • 74
0
votes
1 answer

how to insert unique product name which belongs to different category and department using nodejs

In my project I have product_details, categories, departments table. product_details belongs to categories and departments table and categories has many product_details and departments has many product_details. Am trying to insert product details…
web spider26
  • 252
  • 4
  • 16
-1
votes
0 answers

Column constraints based on specific value MS Access Table

I have a lot of linked documents to my orders in my Microsoft Access database. Now I need to be able to add one of the pictures, which is the customer's design of the product, to the order confirmation and other documents used in later processes. I…
-1
votes
1 answer

How to handle SQLite Unique Constraints error when the value already exists?

Have created a database and use unique constraints to avoid duplicate values. When I try to add a value that violates that rule, the app crashes. How would you solve it? Should I first make a SQL query and see if the value already exists and if it…
DanneManne
  • 19
  • 6
-1
votes
1 answer

Using a primary key with a sequence that cycles results in "duplicate key violates unique constraint" errors after wrap around in Postgresql

BACKGROUND/CONTEXT If I define a sequence and a table as follows: CREATE SEQUENCE public.test_sequence CYCLE MINVALUE 1 MAXVALUE 2147483647; CREATE TABLE public.test_table ( id integer NOT NULL DEFAULT…
-1
votes
2 answers

Why does Oracle not allow DML for null valued referencing columns?

Why is DML not allowed for null valued referencing columns when the using index of the key referenced by the foreign key R constraint is unusable? Below contains the setup, an insert example, two update examples, and two delete examples. All of…
-1
votes
1 answer

How to add a row in the postgres table when it is showing duplicate id error even though I haven't passed an id?

So, I generated a table called person from mockaroo of about 1000 rows. Column | Type | Collation | Nullable | …
-1
votes
2 answers

Composite keys and unique constrains performances and alternatives

I'm creating a database using MySQL for a music streaming application for my school project. It has a table "song_discoveries" which has these columns: user_id, song_id and discovery_date. It has no primary key. The "user_id" and "song_id" are…
-1
votes
1 answer

Making .NET REST API bulk upload faster without incurring SQL violation unique key

I have a C# .NET 6 Web API using SQL Server database. I have an API to bulk upload thousands of rows at a time. If I write the service layer to insert each row one at a time, it works, but it is slow. It would be 3x faster if I call…
John Henckel
  • 10,274
  • 3
  • 79
  • 79
-1
votes
1 answer

Create unique rows in Excel with limited data to be used in multiple columns

I would appreciate help how to solve this problem i have in Excel. I would like to create 100 unique rows with 5 columns, where columns should contain unique numbers from a predefined list (1, 2, 3, 4, 5, 6, 7). Same number can only be used once in…
Chris74
  • 1
  • 1
-1
votes
1 answer

how can unique constraint modified in postgresql for column 'A' not unique over same value in column B and unique over different values for column B?

PROBLEM: In a table; column 1 is not unique for same value of column 2 but column 1 value is unique over different values of column 2. How can this condition be implemented in postgreSQL db. Explaination Assume table 1 exists in DB Table…
kisame
  • 11
  • 5