Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Null Foreign Keys
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
Versions des environnements
SQL Server:
SQL Server 2012
Application:
Desktop
Divers
Thread ID:
01622856
Message ID:
01622882
Vues:
41
>>>This is a bit non-traditional and complex relation.
>>
>>Thanks. I'll think about how to simplify it.
>>
>>Also, are you sure you want to have LastUpdatedDate to be getdate() and not CreatedDate. Logically I'd think the first date should be updated every time a row is updated and the first date should be populated once when row is created.
>>
>>That's exactly what I thought I was doing, am I not? Am misunderstanding how default works. I was hoping that on update the lastupdatedate field would be automatically updated if I set up things in this way.
>
>Setting a default will only set a value on an INSERT, not on an UPDATE.
>
>In order to set the LastUpdate date on an UPDATE statement, you'll either need for the application or stored procedure (if you're using them) to set it on an UPDATE....or (as some people will do) you can build an UPDATE trigger that will set the lastupdate date.


O! Right. Thanks. :). newbieness msql showing I guess.

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform