Link to home
Start Free TrialLog in
Avatar of Alex A
Alex A

asked on

SQL Server: default constraint

Table column has default constraint.
Is better to have it's value in INSERT statement or let DEFAULT work?
Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Another advantage of using a default in table column definition is that it will insure that there is NO WAY to get passed it no matter how you execute the insert.

Think of this scenario: in one place where insert is coded you will use the default value, then after a while another developer or dba will code/run an insert without any default, because they forgot, didn't care, whatever reason, and now you have an unwanted result.