How to set default value while insert null value into not null column SQL Server?
First Solution,
insert into t1
select id,isnull(name,'Peter') from t2
Second solution
ALTER TABLE T1 ALTER COLUMN name varchar(255) NULL
insert into t1
select id,name from t2
ALTER TABLE T1 ALTER COLUMN name varchar(255) NOT NULL
So instead of
Insert into t1 select * from t2
you can rewrite your query as
Insert into t1
select col1,col2, ISNULL(name, 'Peter'), othercolumns from t2