Hi
I want to set the default value for a datetime datatype column not null as 2000-01-01 00:00:00.000 but the sql is not executing correctly. It is always inserting value as 1900-01-01 00:00:00.000
How to set the default value appropriately.
Appreciate any help.
hi,
try the following query, probably will help you
declare @t table
(
id int identity (1,1),
name varchar(100),
date datetime default (('2000-01-01'))
)
insert into @t(name,date) values('aaa',getdate())
insert into @t (name) values('bbb')
insert into @t(name,date) values('ccc',getdate())
insert into @t (name)values('ddd')
insert into @t (name,date)values('eee',getdate())
select * from @t
thanks