0
Ask about alter of My SQL SERVER
how can I use alter to change a column from null to not null
5 odpowiedzi
+ 4
For SQL SERVER 2016, perform following steps
1. Update table values for column in question
UPDATE person SET name = 'noname' WHERE name IS NULL;
2. Now alter table definition
ALTER TABLE person ALTER COLUMN name VARCHAR(50) NOT NULL;
+ 3
alter table person modify name varchar (50) not null
Please note that for all record said column should have some value, otherwise the statement will fail.
+ 1
First Step,
UPDATE [Table] SET [Column]=0 WHERE [Column] IS NULL
Second Step,
ALTER TABLE [Table] ALTER COLUMN [Column] INTEGER NOT NULL
0
i cant use modify...with sql server 2016 make erorr
0
thanks everyone