Kbase P105953: SQL-92: How to display SQL-92 TIME data type fields to the milliseconds?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  11/28/2008 |
|
Status: Verified
GOAL:
SQL: Can the SQL TIME data type store and display fields to the milliseconds?
GOAL:
How to display the millisecond portion of an SQL field of TIME data type?
GOAL:
How to invoke the TO_CHAR SQL function?
FACT(s) (Environment):
All Supported Operating Systems
Progress 9.1x
OpenEdge 10.x
FIX:
Yes, a TIME field can be displayed to the milliseconds. By default, SQL-92 displays the TIME data type fields using the 'HH:MI:SS' format. Use the TO_CHAR scalar function to display an SQL-92 TIME field in the 'HH:MI:SS:MLS' format as per the following example:
1. Create a test table:
CREATE TABLE timetest (mytime TIME);
COMMIT;
2. Insert a record and assign mytime field a value including milliseconds:
INSERT INTO timetest VALUES ('12:30:45:925');
COMMIT;
3. Display mytime field with its milliseconds part using the TO_CHAR scalar function:
SELECT TO_CHAR(mytime, 'HH12:MI:SS:MLS') AS TimeWithMilliseconds FROM timetest;