Sql query to calculate age from date of birth in mysql
- how to find age in sql query
- how to calculate age in sql query
- how to find old query in sql server
- how to find age in sql
How to calculate age from date of birth in sql w3schools
How to calculate age from date of birth in excel!
How to Calculate Age of a Person using SQL Codes
You can easily calculate the age of a person by using only a line of sql codes.
As MS SQL Server developers or programmers may need how many years passed between two dates just the same case while calculating the age of a person using sql query or sql queries.
And this may be a problem in some situations if you have missed some critical point that may cause you fall in error or did not make enough tests to figure out tricky situations.
Here is the sql codes for getting the age of a person :
For this age calculation two parameters are required, the @BirthDate parameter is for the persons date of birth and the @CurrentDate parameter is for the date at which the t-sql codes will calculate the age of person.
In order to code in an optimized MS SQL Server development process, as sql developers or SQL Server Administrators we can move sql query codes in SQL Server as user-defined functions.
Just, create a user-defined function to get use of this t-sql code in our other sql batch codes or stored procedures to get a more
- how to find max age in sql
- how to find oldest person in sql