![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » Search Forums » Search Results » View Thread |
Messages 1 to 2 of 2 total |
![]() |
Mon, Nov 7 2022 10:56 AM | Permanent Link |
Yusuf Zorlu MicrotronX - Speditionssoftware vom Profi | Hi, let's say I have following query: select cast( cast(mydatefield as varchar)+' '+ cast(mytimecharfield as varchar) as timestamp) as mydatetime from mytable If the mytimecharfield has a valid value, everything is ok. But sometimes we have a field where the user enters some text like 'none'. Is there a way to catch such errors and generate date + '00:00' directly with elevatedb-sql? -- -- Yusuf Zorlu | MicrotronX |
Tue, Nov 8 2022 12:06 AM | Permanent Link |
Yusuf Zorlu MicrotronX - Speditionssoftware vom Profi | I solved it by creating a FUNCTION: CREATE FUNCTION "mxDateplustime2TimeStamp" (IN "InputDate" DATE, IN "InputTime" varchar) RETURNS TIMESTAMP BEGIN declare mytime time; begin set mytime=cast(InputTime as time); exception set mytime=cast('00:00' as time); end; RETURN cast( cast(InputDate as varchar)+' '+cast(mytime as varchar) as timestamp); END DESCRIPTION 'Convert Date + Varchar to Timestamp and catch errors' VERSION 1.00 -- -- Yusuf Zorlu | MicrotronX |
This web page was last updated on Saturday, June 22, 2024 at 05:51 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |