Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculating Age
Message
De
06/03/2002 14:02:18
Eugenijus Rimkus
SPAB Siauliu energija
Siauliai, Lithuania
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
00627078
Message ID:
00629165
Vues:
28
Hi,

declare @dot datetime, @dt datetime
SET @dot = '03/21/1984'
SET @dt = '03/06/2002'

Select Datediff(Month, @dot, @dt)/12 as age
-- answer of this comand is 18

Select Datediff(Day, @dot, @dt)/365 as age
-- answer of this comand is 17


Look at the date. How do you think how old is man, who's birthday is on @dot. :)


Yours faithfully
Eugenijus
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform