Alter NVARCHAR column from NULL to NOT NULL in sql server -


i've created table column called ratevalue allowing null value want make not null. used sql server 2008 r2

i tried following not work

alter table dbo.aaelement alter column ratevalue nvarchar(50) not null 

the problem pre-existing null values.

get rid of null values first, alter:

update aaelement  set ratevalue = '' ratevalue null go alter table dbo.aaelement alter column ratevalue nvarchar(50) not null 

otherwise constraint violated it's being created.


Comments

Popular posts from this blog

design - Custom Styling Qt Quick Controls -

Unable to remove the www from url on https using .htaccess -