Interviews - C# Corner

Esakki Muthu
Alter a null column to set default value to 0 in SQL server.. In Production environment.
By Esakki Muthu in Databases & DBA onNov 30 2017
  • Gajendra Jangid
    Jan, 2018 29

    UPDATE Table set Column = 0 where Column is null ALTER TABLE Table ALTER Column NUMBER DEFAULT 0 NOT NULL;

    • 4
  • Pergin Sheni
    Jan, 2019 23

    SELECT ISNULL(myColumn, 0 ) FROM myTable

    • 1
  • Afshan Khan
    Feb, 2018 23

    ALTER TABLE TABLENAME ALTER COLUMN COLUMNAME SET DEFAULT 0

    • 1
  • Ankur vijay
    Feb, 2018 19

    No need to update column direct set default constraint create table test( Id int , name varchar(100) ) insert into test (Id)VALUES(2) select * from test alter table test add constraint constarintName default 'No Name' for name insert into test (Id)VALUES(3) select * from test

    • 1
  • Ankur vijay
    Feb, 2018 19

    create table test( Id int , name varchar(100) ) insert into test (Id)VALUES(2) select * from test alter table test add constraint constarintName default 'No Name' for name insert into test (Id)VALUES(3) select * from test

    • 1
  • Tamal Marick
    Apr, 2019 18

    BEGIN TRANUPDATE ColumnName = 0 where ColumnName is nullALTER TABLE TableName ALTER ColumnName NUMBER DEFAULT 0 NOT NULLCOMMIT

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS