drill-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sanjiv Kumar <sanjiv...@gmail.com>
Subject Re: Converting Date to Timestand
Date Thu, 19 Jan 2017 10:50:59 GMT
Hello I am again posting my question in correct format.

Hello I am using Drill latest version (1.9) in window in embedded mode.

I am trying to convert Date to Timestamp.

While Converting I am using following query:-


SELECT  T5.`Name` AS `Website Name`,  T5.`Description` AS
`Description`,TO_CHAR((CAST(T5.`CreateOn`
AS TIMESTAMP)), 'MM-dd-yyyy hh:mm:ss a') AS `CreateOn` FROM
<plugingName>.<schemaName>.<tableName1>
AS T4 INNER JOIN <plugingName>.<schemaName>.<tableName2>AS T5 ON T5.`ID`
= T4.`WebsiteID`

NOTE:- IN MY DATABASE CREATEDON DATA IS LIKE This Format:-  2017-01-05
08:09:17.020

O/p:- If I used this query CreatedOn Column Converted Successfully,
but My WEBSITENAME Columns
showing null values..

Website Name		       Description				CreateOn
null 				Hootonics 			01-05-2017 08:09:17 AM
null 				Hootonics 			01-05-2017 08:09:17 AM
null 				Hootonics 			01-05-2017 08:09:17 AM
null 				Hootonics 			01-05-2017 08:09:17 AM
null 				Hootonics 			01-05-2017 08:09:17 AM
null 				Hootonics 			01-05-2017 08:09:17 AM



But  IF I remove TO_CHAR((CAST(T5.`CreateOn` AS TIMESTAMP)),
'MM-dd-yyyy hh:mm:ss a') AS `CreateOn`
Column from Select query Output showing fine.

Please Tell me what i am doing wrong? And How to Convert (2017-01-05
08:09:17.020) data to
(01-05-2017 08:09:17 AM).??

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message