Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
select datediff(mm,'07/06/1961',getdate())/12
declare @today smalldatetime
set @today = '07/31/2005'
select datediff(mm, '07/06/1961', @today)/12
declare @today smalldatetime, @dob smalldatetime
set @today = getdate()
set @dob = '07/06/1961'
select datediff(yy, @dob, @today) -
case when right(convert(varchar(8), @today, 112), 4) < right(convert(varchar(8), @dob, 112), 4)
then 1
else 0 end
select year(@today - @dob) - 1900
i think the best thing to take away from that thread is: "Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil!"gmmastros said:There's a good thread that occurred a couple months ago dealing with this particular topic.
select dob
, datediff(yy,dob,getdate())
- sign(
floor(datepart(dy,dob)
/datepart(dy,getdate()))) as age
from daTable