![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 5 of 5 total |
![]() |
Tue, Dec 1 2020 11:57 PM | Permanent Link |
Steve Gill | I'm sure I've done this before but I can't seem to find the code anywhere.
Does anyone know how you increment time by minutes by using a variable instead of an Interval constant? DECLARE StartTime TIME; DECLARE EndTime TIME; DECLARE Duration INTEGER; SET Duration = 30; SET StartTime = CAST(AppointmentTime AS TIME); SET EndTime = CAST(AppointmentTime AS TIME); -- SET EndTime = StartTime + INTERVAL '60' MINUTE; SET EndTime = StartTime + INTERVAL Duration MINUTE; Thanks. = Steve |
Wed, Dec 2 2020 1:43 AM | Permanent Link |
Yusuf Zorlu MicrotronX - Speditionssoftware vom Profi | Steve Gill wrote:
> I'm sure I've done this before but I can't seem to find the code > anywhere. > > Does anyone know how you increment time by minutes by using a > variable instead of an Interval constant? > > DECLARE StartTime TIME; > DECLARE EndTime TIME; > DECLARE Duration INTEGER; > > SET Duration = 30; > > SET StartTime = CAST(AppointmentTime AS TIME); > SET EndTime = CAST(AppointmentTime AS TIME); > > -- SET EndTime = StartTime + INTERVAL '60' MINUTE; > SET EndTime = StartTime + INTERVAL Duration MINUTE; > > Thanks. > > = Steve Hi Steve, what about defining the Duration as VARCHAR? DECLARE Duration VARCHAR; SET Duration='30'; -- -- Yusuf Zorlu | MicrotronX |
Wed, Dec 2 2020 4:03 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | Steve
>I'm sure I've done this before but I can't seem to find the code anywhere. AFAIK it has to be a constant - its a question I asked yonks ago and apparently the spec says constant. The only exception seems to be if its a column. However, since you seem to be doing it in a script it may be possible to fudge it. Nothing comes straight to mind but I'll have a think later. Roy |
Wed, Dec 2 2020 4:46 PM | Permanent Link |
Steve Gill | Hi Yusuf,
<< what about defining the Duration as VARCHAR? DECLARE Duration VARCHAR; SET Duration='30'; >> Thanks, I tried that but it didn't seem to work. = Steve |
Wed, Dec 2 2020 4:47 PM | Permanent Link |
Steve Gill | Hi Roy,
<< AFAIK it has to be a constant - its a question I asked yonks ago and apparently the spec says constant. The only exception seems to be if its a column. However, since you seem to be doing it in a script it may be possible to fudge it. Nothing comes straight to mind but I'll have a think later. >> Yeah I thought as much. Never mind, I'm going to do it a different way. Thanks. = Steve |
This web page was last updated on Wednesday, August 14, 2024 at 07:31 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |