Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Null Foreign Keys
Message
De
03/08/2015 03:57:04
 
 
À
03/08/2015 01:46:38
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:
01622895
Vues:
39
>>>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.

I would have guessed your ordered preferences to be SP, trigger, application, but interpret the above otherwise? No worry about clock differences between client machines?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform