[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 148
  • Last Modified:

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

0
Jeff S
Asked:
Jeff S
  • 2
1 Solution
 
leakim971PluritechnicianCommented:
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now