We use firebird as a local testing database and most of our clients use SQL Server or Oracle.
This works in MS SQL Server, but not in Firebird. (haven’t tested it n Oracle yet)
CONVERT(char(8),MAX(p.end_Time)-MIN (p.start_Time),8) as duration
is there a way to acoomplish this same thing for (Firebird, Oracle, and MS Sql Server)?
thanks
For Firebird you need to use
DATEDIFFto obtain a difference between two timestamps (datetimes). This BTW is similar to the SQL ServerDATEDIFF. If you then want to cast it to char, you can useCAST, egCAST(DATEDIFF(DAY, MAX(p.end_Time), MIN(p.start_Time)) AS CHAR(8))should do the trick (or you can simply doCAST(MAX(p.end_Time) - MIN (p.start_Time) AS CHAR(8))as timestamps are subtractable.I just noticed though that the option you specify in your
CONVERTwill convert tohh:mi:ss. There is no such option in Firebird. If you need to convert specifically tohh:mi:ss, you might want to look at UDF libraries like FreeAdhocUDF (specificallyF_SECONDS2PERIOD) or rFunc UDF. If all else fails, you could write your own UDF.