Get date of birth in T SQL


There are many ways to find the date of birth using T SQL; complicated and simple. Here is a simple example to find the date of birth without using much resources


SELECT FLOOR(DATEDIFF(DAY, @BirthDate, GETDATE()) / 365.25)


This will give you the age as of now. Its very accurate and also will take care of leap year, since we are considering a year as 365.25 days.


Kindly pot your suggestions or ideas as comments, so that others can make use of your ideas...

No comments:

Post a Comment