I've got a database table (SQL Server 2008 R2 Express edition) which has a column having a nullable value and that i would like it to possess a default value area only when the information I'm entering is null otherwise the area should obtain the passed value. I've read something about triggers in SQL Server that may accomplish this (pretty hard for me) and I'm wondering if there's some smart way for this.

ALTER TABLE some_table
  ADD CONSTRAINT DF_some_field
  DEFAULT 'some_default_value'
  FOR some_field


This is a tutorial regarding how to set default column values in sql server.


Whenever you choose a column within the management studio gui, you can observe "Default Value or Binding" within the column qualities.

alternatively in your card inserts you could utilize something similar to the next

insert into mytable (x, y, z) values (isnull(@x, 'myvalue'), y, z)  

But for me obtaining the table to default the worthiness and evaluate which is wrong with that's a great way. (unless of course you've multiple methods for putting records within the table as well as your strategy is the only person to default towards the value you would like....