Skip to content Skip to sidebar Skip to footer

Need To Add Constraint: Date Plus 10 Days

I'm trying to add a constraint to a table so that it displays one of the columns as the current date plus 10 days. Here's what I've tried so far (I'm very new to SQL): ALTER TABLE

Solution 1:

The syntax in SQL-Server, for adding a DEFAULT value to an existing column is:

ALTERTABLE     orders
ADDCONSTRAINT  required_date_plus_ten
DEFAULT         DATEADD(day, 10, GETDATE())
FOR             required_date ;

Tested in SQL-Fiddle

Post a Comment for "Need To Add Constraint: Date Plus 10 Days"