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
0 answers

neo4j: java: can we force GraphDB NOT TO HAVE nodes with duplicate Node_Key? If yes how can we do it?

A sample code and situation related to this is discussed in following question: https://stackoverflow.com/questions/15406867/neo4j-java-error-in-indexhits-getsingle-due-to-multiple-nodes-returned-for-g/15408058#15408058 I'm creating a network graph…
N D Thokare
  • 1,703
  • 6
  • 35
  • 57
0
votes
1 answer

Unique constraint violation with single character insert

I have a unique constraint on a SQL server 2008 database table, with the constraint containing 4 columns. While entering in some test data, I unexpectedly received a unique constraint violation. For the four columns I was just entering in a number,…
0
votes
1 answer

Primary Key on existing data

I need to delete existing PK from table and create new in new column. Because column for new PK was added later (after table creation) - we have nulls for old rows. Should I use UPDATE statement or there is some option in "ADD CONSTRAINT" clause…
Roman Badiornyi
  • 1,509
  • 14
  • 28
0
votes
2 answers

one to many unique "set" oracle db

I am not sure how to create a one to many relationship, but restrict the many items as a "set" to each unique primary key. DB: Oracle 11g Example: PK Table: CUST(PK) 100 200 Valid FK Table Data: CUST(FK) | ITEM 100 | 101 100 | 102 200 | 101 200 |…
0
votes
2 answers

Update multiple records, with temporary key overlap

I've a table on DB with the following fields as PK: DOC_ID, SECTION_ID, SET_ID, CELL_ID. As you can deduce, this is referred to a set of Excel spreadsheets. In addition to those fields, I have a CELL_ROW field and CELL_COL field. With the SET_ID…
Teejay
  • 7,210
  • 10
  • 45
  • 76
0
votes
2 answers

SQl Constraint UNIQUE based on other column value

Table A has columns 1 and 2. Column 1's value must be unique if column 2 is equal to x. ALTER TABLE A ADD UNIQUE (1) WHERE 2 = x. But this gives me a syntax error near WHERE. I tried to create an index, but I can't figure out how to make that do…
Shawn
  • 2,356
  • 6
  • 48
  • 82
0
votes
2 answers

Child insertion fails in one to many hibernate mapping(because of a unique key in child) but parent still gets persisted

I have a one to many relationship between BookShelf and Book. The ISBN number in the book table is a unique field. Now when i try to insert a shelf with a set of books (with same isbn numbers )i get a constraint violation exception and the records…
0
votes
3 answers

How to update in SQL to get distinct tuples / not to violate a unique constraint

I have a mapping table with a unique contraint on the tuple (c_id, t_id). Here's some sample data to illustrate the situation: id c_id t_id ---------------- 1 10 2 2 10 3 3 10 7 4 12 2 5 13 3 I wrote a…
Smamatti
  • 3,901
  • 3
  • 32
  • 43
0
votes
1 answer

Oracle COLUMN_ID implicit index creation

How does Oracle use COLUMN_ID as found in USER_TAB_COLUMNS view? I just need to confirm that it does not use this internal column ordering while creating implicit indexes - such as when a primary key is enforced or a unique key constraint is created…
0
votes
1 answer

Validate unique username or email

I have two files, one contains reg_db class, in other i call object of reg_db. I want it to check user input and column in database, to make sure it will be only unique values. And if it's not unique to stop code, with message. For now i dont get…
Driglou
  • 97
  • 2
  • 10
0
votes
2 answers

EF Code First, Unique Contraints, and Testing

We currently are implementing our Unique constraint by executing SQL directly in the Seed method context.Database.ExecuteSqlCommand( "BEGIN TRY ALTER TABLE MyTable ADD CONSTRAINT UC_CODE UNIQUE (COL1, COL2, COL3) END TRY BEGIN CATCH END…
CaffGeek
  • 21,856
  • 17
  • 100
  • 184
0
votes
3 answers

How to validate uniqueness in JSF and get a message to the user?

I need to check the uniqueness of a field in my application. I tried to use Hibernate @Unique constraint but it shows a stacktrace, but no error message in the user form. My next solution would be to write a custom validator, but I think there is a…
Migore
  • 1,477
  • 3
  • 19
  • 40
0
votes
0 answers

ORA0001: Unique Contraint causing web application shutdown

Has anyone run across this? An Oracle ORA0001: Unique Constraint violation originating from a JMX endpoint is causing an instance of my deployed application (Tomcat) to shutdown. I have looked online but do not see anything. Any ideas?
OceanBlue
  • 9,142
  • 21
  • 62
  • 84
0
votes
1 answer

Identity insert few records without truncating to an existing table

I would like to insert data from a table which is in A server from the B server. ex: select count(*) from A.table -- 100 rows affected delete from A.table where customer_code = '100' -- 10 rows affected select count(*) from B.table -- 200 rows…
0
votes
1 answer

mysql duplicate check on 2 columns together

Table |ID|owner|page|value| |1 |0001 |home|demo | |2 |0003 |home|demo | |3 |0001 |home|demo | what i want is to prevent owner to set 2 values for same page. so my current approch was |ID|owner|page|value|unique_check |1 |0001 |home|demo…
Zalaboza
  • 8,899
  • 16
  • 77
  • 142