I have a column in an Sql server express table called DepTime which has a Time data type.
I would like to set the Default value for this column to Current Time + 6hrs.
How can I do this.
Thank you
I have a column in an Sql server express table called DepTime which has a Time data type.
I would like to set the Default value for this column to Current Time + 6hrs.
How can I do this.
Thank you
here is an example for a temporary table:
CREATE TABLE #tmp (
test varchar(30),
DepTime datetime DEFAULT DATEADD(hour, 6, GETDATE())
);
or if you already have a table:
ALTER TABLE SomeTable
ADD CONSTRAINT DF_SomeTableSomeName
DEFAULT DATEADD(hour, 6, GETDATE()) FOR DepTime;