MSSQL Default Values
If you want to use an integer and want to increment the value for each new record you can use this snippet:
ALTER TABLE mytable ADD mycolumn int IDENTITY(1,1) NOT NULL
To set default value to datetime column with actual time use this:
ALTER TABLE mytable ADD mycolumn datetime NOT NULL DEFAULT (getdate())
Would you like to get top 5 links on C# every Monday?
Sign up to C# Digest and stay up to date!
Did you like the article? Send me a comment!