SQL 2005 DateFormatting / Output to custom value

I would like to take my field PatientProfile.Birthdate and make it 3 fields.

Example - DOB = 01/15/1960

I want this in my output

'DOBMonth' = 01
'DOBDay' = 15
'DOBYear' = 1960

LVL 7
Jeff SAsked:
Who is Participating?
 
leakim971Connect With a Mentor PluritechnicianCommented:
Hello JeffSturgeon2002,

Try :



SELECT DATEPART(month,DOB) 'DOBMonth', DATEPART(day,DOB) 'DOBDay', DATEPART(year,DOB) 'DOBYear' FROM youTable

Open in new window

0
 
Aneesh RetnakaranDatabase AdministratorCommented:
or

select DAY(dob), MONTH(dob ), YEAR(dob )
from yourtable
0
 
Jeff SAuthor Commented:
THANKS!!
0
 
leakim971PluritechnicianCommented:
You're welcome! Thanks for the points and see you soon!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.