6

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..

2
  • 1
    there is no attached picture (and I don't think you'll be able to attach, your rep is too low), so your question makes no sense. Please explain yourself Commented May 30, 2015 at 16:31
  • @Amit - the image was in the question markdown stackoverflow.com/posts/30548532/edit/… Commented May 30, 2015 at 18:17

2 Answers 2

10

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)

Sign up to request clarification or add additional context in comments.

1 Comment

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

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.