Answer – Objective Question (How many Null values in an unique constraint can be inserted in SQL Server)

Question:- How many NULL value allowed in a column in which Unique constraint is defined in SQL Server?

Options:-

a) 1

b) 2

c) More than 1

Answer :- Option a) 1

In SQL Server, we can Insert only one null value in a column where we have defined the Unique Constraint.

For Example , suppose we made a table test_unique, whose script is given below:-

create table test_unique (id int unique)

Now we insert the following values in it.

insert into test_unique(id) values (1)

insert into test_unique(id) values (2)

insert into test_unique(id) values (NULL)

insert into test_unique(id) values (3)

Here we inserted one null value before inserting 3.

If we see the records in the table , it shows the following data.

Let try to insert another NULL value and see what error it gives.

insert into test_unique(id) values (NULL)

Then it will gives the following error

So, In SQL server we can insert only one NULL value in a column where Unique constraint is defined.

DMCA.com

About vivekjohari

Database Consultant with more than 11.5 years of experience in database designing & programming and DBA related activities.  Had good experience on different databases like SQL Server, MySQL & Oracle, Azure SQL &  Big Data.
This entry was posted in Interview Questions and tagged . Bookmark the permalink.

31 Responses to Answer – Objective Question (How many Null values in an unique constraint can be inserted in SQL Server)

  1. Pingback: Charlotte North Carolina florist

  2. Pingback: The Latest Information of Sexy Real Sex Doll

  3. Pingback: Euro 2020

  4. Pingback: click over here

  5. Pingback: car hire Malta

  6. Pingback: Istanaimpian2

  7. Pingback: their website

  8. Pingback: บาคาร่า

  9. Pingback: Best Real Estate Agent Tallahassee

  10. Pingback: fire doors melbourne

  11. Pingback: 인터넷바카라

  12. Pingback: 온라인카지노

  13. Pingback: custom elevator decal

  14. Pingback: 온라인 바카라 사이트

  15. Pingback: tree removal nashville tn

  16. Pingback: Offshore Company Formation

  17. Pingback: didi free rides

  18. Pingback: Small business website designs and marketing

  19. Pingback: 메이저사이트

  20. Pingback: custom instrument cases

  21. Pingback: w88

  22. Pingback: UBER SIGN UP CODE X6908

  23. Pingback: บริการ เงิน ด่วน ใน ระบบ

  24. Pingback: Bassett Caterers

  25. Pingback: Dream Market

  26. Pingback: Drogen

  27. Pingback: เงิน ด่วน ดอกเบี้ย ถูก มาก

  28. Pingback: w88 casino

  29. Pingback: w88 win

  30. Pingback: กังนัม คลินิก

  31. Pingback: Ghana Mining Market 2020 Share, Trends, Segmentation, Analysis and Forecast to 2026

Leave a Reply