Conditional Default constraints

  • Is there any way to set up a conditional default constraint? For example, if a certain column in a table = 'X' then I want a default for another column in the same table to be 'Y'.

  • Only thru where insert code is done or thru a trigger. However you could make a column for the data to be instered without the default and then add a computed column that looks and if columnx is null generates a X or Y based on the condition. Or even better do in the view or select statement thus you don't have to worry about the constraint.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply