Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using trigger instead of defaults?
Message
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Titre:
Using trigger instead of defaults?
Divers
Thread ID:
01014238
Message ID:
01014238
Vues:
66
I want to create a default value for a column when new records are added but the default value depends on value of another column and I don't know how this can be best done.

For example, if I have a very simple table with just two character columns of FIELD1 & FIELD2, I want the default value of FIELD2 to be:

1) If value of FIELD1='MOMMY' then default for FIELD2='WOMEN'
2) If vlaue of FIELD2='DADDY' then default for FIELD2='MEN'

How can I go about doing this using either DEFAULT or TRIGGER? TIA.
It's "my" world. You're just living in it.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform