SQL Server - How make allow NULL value in column

17,764

Solution 1

It looks as though the designer is trying to re-create the whole table and warning you about that.

It is possible to allow it to do so by disabling the option specified in the error message to "prevent saving changes that require the table to be recreated" but there is no need for this here.

You can just run

ALTER TABLE SAMPLE_UPL
  ALTER COLUMN KORESKI VARCHAR(300) NULL

Or simply

ALTER TABLE SAMPLE_UPL
  ALTER COLUMN KORESKI VARCHAR(300) 

(as altering an existing column always sets it to allow NULL unless explicitly specified otherwise)

Solution 2

go in table design and checked check box this can allow you null valuesenter image description here

script of this table

CREATE TABLE [dbo].[AWBuildVersion](
    [SystemInformationID] [tinyint] IDENTITY(1,1) NOT NULL,
    [Database Version] [nvarchar](25) NULL,
    [VersionDate] [datetime] NOT NULL,
    [ModifiedDate] [datetime] NOT NULL,
 CONSTRAINT [PK_AWBuildVersion_SystemInformationID] PRIMARY KEY CLUSTERED 
(
    [SystemInformationID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
Share:
17,764
Afif Pratama
Author by

Afif Pratama

Just want to be autodidact programmer

Updated on June 15, 2022

Comments

  • Afif Pratama
    Afif Pratama almost 2 years

    I'm newbie level in SQL Server

    I want to allow null value in column, but it can't save.

    enter link description here

    So I will re-create a new table with same structure.

    Please your help to allow null value in column with SQL script. Thank you..

  • tjeloep
    tjeloep almost 9 years
    i think this one is better answer as it describes the root cause of the OP's problem and provides simplest solution. [+1]