Subject Re: [firebird-support] How do I get the differences between 2 timestamps as a timestamp.
Author Helen Borrie
At 12:01 p.m. 4/06/2013, cornievs wrote:
>I have the following table (Staff_Events)
>
>...
>Start_Date TIMESTAMP,
>End_Date TIMESTAMP,
>Period TIMESTAMP,
>....
>
>and need to set Period to the time difference between End_Date and Start_Date. End_Date will always be later than Start_Date. (Enforce by on Insert/Update triggers.)
>
>I know I can the get difference with DATEDIFF, but I need the result as a TimeStamp.

It is not possible. The difference between two timestamps gives you a number representing days and parts thereof. Your Period column is the wrong type. Make it a CHAR of a suitable length and use an expression to convert the difference into the string you want.


Helen Borrie, Support Consultant, IBPhoenix (Pacific)
Author of "The Firebird Book" and "The Firebird Book Second Edition"
http://www.firebird-books.net
__________________________________________________________________