Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Here is my code

select PatientName,DATE_FORMAT(DOB,'%m/%d/%Y') as DOB,Age,DATE_FORMAT(CDate,'%m/%d/%Y') as Date,CONVERT(VARCHAR(10),CTime,110) as Time,EncounterType from encounter

// CONVERT(VARCHAR(10),CTime,110) as Time "Error Section"

Please Help
Posted

SQL
select CONVERT(VARCHAR(10),CTime,108) as Time

Yields 10:05:35

SQL
select FORMAT(CTime,'hh:mm:sstt') as Time

Yields 10:05:35AM
Note: Use of the FORMAT() function requires the .NET CLR to be installed on the SQL Server
 
Share this answer
 
v5
Comments
Member 8653959 21-Jan-14 6:58am    
Thanks for your answer.
This article shows the different numbers formats you can use to get the various parts.

http://msdn.microsoft.com/en-us/library/ms187928.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900