sql - Multiple Converts -
I have looked through orders online and through my book, without any luck. This is the last part of the problem. "Display current age of all employees." My tables and columns are: Employee Column: Name (VARCHAR (20), blank), address (VARCHAR (20), blank), Employee Number (INT, blank), Salary (SMALLMONEY, blank), Birthday (DATE, blank) ), Employment (date, blank)
Whatever I have found is changing one or two birth dates online. Is there any order to convert many people to write in their birthdate in the query?
DECLARE @ dob datetime SET @ dob = '1992-01-09 00:00:00 "/ code> What do I have to do
Choose Name Name Date Date SET @ dob = 'yyyy-mm-dd' Something like this, I think there are 37 lines of names that I used to date Age will need to be changed. Any help is greatly appreciated, thanks in advance for help.
You already have the date of birth
column as date
To calculate the age, you need the difference between it and now (the function getdate ()
:
select name , DATEDIFF year, GETDATE (), date of birth) as employee age
Comments
Post a Comment