Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculating Age
Message
From
06/03/2002 14:02:18
Eugenijus Rimkus
SPAB Siauliu energija
Siauliai, Lithuania
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Miscellaneous
Thread ID:
00627078
Message ID:
00629165
Views:
33
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform