Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 3 of 3 total |
Adding an INTERVAL to a date where the interval is a user-variable |
Thu, Jan 5 2012 12:19 PM | Permanent Link |
Adam Brett Orixa Systems | I am used to this:
DateRequired + INTERVAL '2' HOUR i.e. having a datefield & adding some extra hours / days etc. However, I am having trouble formulating SQL to do the following: SELECT ID, TableName, CAST('Maintenance DUE' as CHAR(60)) as Title, CAST(M.DateRequired as TIMESTAMP) as DateStart, CAST(M.DateRequired + INTERVAL '''' + CAST(LabourHours as VARCHAR(3)) + '''' HOUR as TIMESTAMP) as DateEnd FROM Maintenance M LEFT JOIN Assets A ON M.AssetsID = A.ID -- I want to generate a dataset which can display a record in a diary / timesheet component, a la outlook. Crucially this component (the dxScheduler) lays out all the events with different sizes depending on how long they last. I could put in a static value like this: CAST(M.DateRequired + INTERVAL '4' HOUR as TIMESTAMP) as DateEnd ... but that doesn't cope well with different length tasks. Is it possible to pass in a dynamic value to the INTERVAL using a variable from a table or elsewhere & if so how would I do this |
Thu, Jan 5 2012 1:22 PM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Adam
Just tested this is EDBManager select _fkprojects, _hidealarm + cast(_fkprojects as interval hour), _hidealarm from calls where _hidealarm is not null MIght get you under way Roy Lambert [Team Elevate] |
Fri, Jan 6 2012 8:46 AM | Permanent Link |
Adam Brett Orixa Systems | Thanks Roy.
|
This web page was last updated on Tuesday, May 7, 2024 at 02:40 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |