Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
spradhan
Starting Member
3 Posts |
Posted - 2010-03-18 : 18:32:00
|
Actually i create field and assign as foriegn key for table and accidentally i allow null for that field in table but in primary table it is primary key and don't allow null.So when i found that i allow null for that field i changed it to not allow null and try to save table but it didn't allow to save or modify table.So how can i save table. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
spradhan
Starting Member
3 Posts |
Posted - 2010-03-19 : 18:46:29
|
I try it as you mention but again i get message like this:Unable to modify table. Cannot insert the value NULL into column 'HistoryID', table 'MyDatabase.dbo.Tmp_tblMHistory'; column does not allow nulls. INSERT fails. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-20 : 01:47:57
|
you cant modify an existing column to be of type NOT NULL unless you specify a DEFAULT constraint for it or you change all NULL values in it to a NON NULL value using UPDATE before modification.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|