How to set a default to a column in a SQL Server table

Home > Search > How-to
  by

Follow these steps to set a default to a column in a SQL Server table. In this example, the table name is MyTable, the column name is Col1, and we set 0 as the default value for the column.

  1. Sign into SQL Server Management Studio
  2. At the top, select New Query
  3. Type the following SQL command into the middle area:
ALTER TABLE MyTable ADD DEFAULT '0' FOR COL1;
  1. At the top, select Execute

 

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments