For modifying an existing column in an existing table:
ALTER TABLE YourTable ADD CONSTRAINT DF_YourTable DEFAULT GETDATE() FOR YourColumn
More Related Contents:
- Sql Server string to date conversion
- How to convert SQL Server’s timestamp column to datetime format
- How can I truncate a datetime in SQL Server?
- What is the significance of 1/1/1753 in SQL Server?
- How to get Time from DateTime format in SQL?
- How to get first and last day of previous month (with timestamp) in SQL Server
- How to remove the time portion of a datetime value (SQL Server)?
- SQL – The conversion of a varchar data type to a datetime data type resulted in an out-of-range value
- Date conversion and culture: Difference between DATE and DATETIME
- SQL Query to find the last day of the month
- Handling date in SQL Server
- How can I get the sum of multiple datetime values?
- Comparing dates stored as varchar
- Best way to store time (hh:mm) in a database
- Retrieving the date in SQL Server; CURRENT_TIMESTAMP vs GetDate()
- SQL Server Group by Count of DateTime Per Hour?
- Why SQL Server DATETIME type saves time in ticks of 1/300 of a sec?
- SQL Server: convert ((int)year,(int)month,(int)day) to Datetime [duplicate]
- Convert a string with ‘YYYYMMDDHHMMSS’ format to datetime
- Convert UTC Milliseconds to DATETIME in SQL server
- How does SQL Server decide format for implicit datetime conversion?
- Undesired rounding of DateTime in SQL Server
- How to convert text column to datetime in SQL
- How to calculate difference in hours (decimal) between two dates in SQL Server?
- Subquery in select not working in SQL Server
- Dynamic SQL (passing table name as parameter)
- SQL Server convert string to datetime
- What happens if you don’t commit a transaction to a database (say, SQL Server)?
- Dynamically assign filename to excel connection string
- T-SQL query to show table definition?