Hi,
I'm working with an SQL 2000 DB to extract an appoitment date/time and trying to format it so that I can insert it into an HL7 message. Here is the command that I am using to extract the date and time fields:
My results using the above code is: 2009-04-23 16:00:00.000
The format that I am trying to achieve is:
200904231600 (CCYYMMDDHHSS)
Is there an way in which this can be done using SQL? I have been successful to get just the date field to work using the following code:
Which give me this as a result: 20090423
So I'm stuck as to get the 'Time' section. I would greatly appreciate any/all assistance that you can provide.
Kind Regards,
Glenn
I'm working with an SQL 2000 DB to extract an appoitment date/time and trying to format it so that I can insert it into an HL7 message. Here is the command that I am using to extract the date and time fields:
Code:
CONVERT(varchar(20),dateadd(day,appt.apptdate-1,'12/31/1899'),102)+Convert(datetime,tsr.displayvalue) as apptDtTm
My results using the above code is: 2009-04-23 16:00:00.000
The format that I am trying to achieve is:
200904231600 (CCYYMMDDHHSS)
Is there an way in which this can be done using SQL? I have been successful to get just the date field to work using the following code:
Code:
CONVERT(varchar(20),dateadd(day,appt.apptdate-1,'12/31/1899'),112) as apptDT
So I'm stuck as to get the 'Time' section. I would greatly appreciate any/all assistance that you can provide.
Kind Regards,
Glenn