Can we have more than one NULL in a column having unique
constraint?
Answers were Sorted based on User's Feedback
Answer / kalu
No, because Unique constraint accepts only one null value.
| Is This Answer Correct ? | 16 Yes | 3 No |
Answer / p.prabhu
No we cant have More than One Null in a column which is
having Unique Key Constraint. Because Unique Key Constraint
means having a value only once in the column.
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / santhoshkumar.k
No we can not have that option in sql server
| Is This Answer Correct ? | 4 Yes | 2 No |
Answer / krishnaraj p n
UNIQUE constraints can accept NULL just once. If the
constraint is defined in a combination of fields, then
every field can accept NULL and can have some values on
them, as long as the combination values is unique.
| Is This Answer Correct ? | 2 Yes | 0 No |
No this is not possible... columns with Unique constraint
can only contain 1 null value/row.
@Manish... could you please try this:
create table #tempTable (id int, name varchar(50) unique)
insert into #tempTable
select 1, 'manoj' union
select 2, null union
select 3, null union
select 4, 'pandey'
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / maneesh
Yes there can be any number of NULLs.
Remember NULL <> NULL.
So uniqueness will still be there.
Just try it out.
Maneesh
| Is This Answer Correct ? | 6 Yes | 6 No |
Answer / habibur rahaman
It depends upon the database on which you are working.....in SQL we can have only one value but in oracle we can have n no of values.......i did it practically.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sasikumar
It is possible in Oracle database (NULL <> NULL) but not
possible in SQL server.
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / drona
UNIQUE constraints can accept NULL just once.
I have a dought?
Every null is different?
| Is This Answer Correct ? | 0 Yes | 0 No |
Is it true that rules do not apply to data already existing in a database at the time the rule is created?
application server is slow what may be the problem
What is normalization of database?
What is the use of SCOPE_IDENTITY() function?
What is the maximum number of index per table?
What happens if we shrink log file in sql server?
Tell me what are the essential components of sql server service broker?
How do I delete a sql server database?
IF more than one Site is accessing the same Database server and I want to move the DB with Minimum down time? How will you do
What is sql profiler. What are the default templates with it? : sql server database administration
what is the different types of backups available in sql server? : Sql server database administration
How do I start sql server?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)