Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a table with a primary key in SQL Server 2008.
When I try to update the primary key to null, it is happening, Is this a feature of SQL that you can update the primary key to null?
Posted

To simply put it, primary key can never be null.

If you need a key that can sometimes be null, consider using a unique key.

References:
- Primary key[^]
- Unique key[^]
 
Share this answer
 
v2
Absolutely not my dear...

Primary key column always keeps data NOT NULL and UNIQUE.
 
Share this answer
 
Thanks!
I think I got where I was going wrong. Some how through the UI, an empty string was getting inserted into the primary column . So, it was not actually a null value.
 
Share this answer
 
No you cannot make Primary key to a Null value
 
Share this answer
 
No primary key always have some value... it never to be null...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900