none
Set default value or binding to another column

    Question

  • I want the default value for a field to be equal to another field within the same record, I tried to set Default Value or Binding of this column to a source column but it doesn't work, should I create a Trigger instead?
    Tuesday, August 25, 2009 6:30 PM

Answers

  • Yes, that would have to be done by a trigger. A default object or default constraint cannot refer to "data" in the table or row. You could use a user-defined function in your default definition, but you still don't have anything with which you can find "this row" with...
    Tibor Karaszi, SQL Server MVP http://www.karaszi.com/sqlserver/default.asp http://sqlblog.com/blogs/tibor_karaszi
    Tuesday, August 25, 2009 6:52 PM
    Moderator