![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 10 of 32 total |
![]() |
Sat, May 26 2012 4:04 AM | Permanent Link |
Hershcu Sorin | Hello
I cand find the right syntax for the statement that return the NewDateField SELECT DateField + a integer of months AS NewDateField Thanks Sorin |
Sat, May 26 2012 8:20 AM | Permanent Link |
Uli Becker | Sorin,
> I cand find the right syntax for the statement that return the NewDateField > > SELECT DateField + a integer of months AS NewDateField You have to work with intervals. Not the quotes! select DateField + interval '1' month as NewDateField from ... Uli |
Sat, May 26 2012 8:21 AM | Permanent Link |
Uli Becker | correction:
I meant "note the quotes" not "not the quotes". Tiny typo, big difference. ![]() Uli |
Sat, May 26 2012 8:42 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | Uli
Nice typo - I think I prefer it to the correct version ![]() Also note that the interval can't be specified as a parameter. If you want to change it you have to change the sql. Roy Lambert [Team Elevate] |
Sat, May 26 2012 9:50 AM | Permanent Link |
Uli Becker | Roy,
> Nice typo - I think I prefer it to the correct version ![]() ![]() > Also note that the interval can't be specified as a parameter. If you want to change it you have to change the sql. In such cases I use something like this: select Datefield + interval ''' + Cast(MyIntValue as Varchar) + ''' month from MyTable'; Uli |
Sat, May 26 2012 10:02 AM | Permanent Link |
Hershcu Sorin | Thanks
That mean that if I want do something like select DateField, DateField + interval NumberField month as NewDateField... I can't? Sorin > Also note that the interval can't be specified as a parameter. If you want > to change it you have to change the sql. > > Roy Lambert [Team Elevate] > |
Sat, May 26 2012 10:17 AM | Permanent Link |
Hershcu Sorin | Thanks Uli
I try select DateField + interval ''' +cast(intField as varchar) + ''' month as NewDateField... but it raise error #700 before interval Sorin |
Sun, May 27 2012 2:39 AM | Permanent Link |
Uli Becker | This script with a table called "Kalender" and a Date Column called
"Datum" does work: SCRIPT BEGIN DECLARE Result CURSOR WITH RETURN FOR Stmt; DECLARE Delta INTEGER DEFAULT 2; PREPARE Stmt FROM 'select Datum + interval ''' + cast(Delta as varchar) + ''' month as NewDateField from Kalender'; OPEN Result; END Uli |
Mon, May 28 2012 5:55 AM | Permanent Link |
Hershcu Sorin | Thanks Uli
I need the state in a query not in a script. edbQuery.sql.text := 'select Datum + interval ''' + cast(Delta as varchar) + ''' month as... Does it make any difference? > SCRIPT > BEGIN > > DECLARE Result CURSOR WITH RETURN FOR Stmt; > DECLARE Delta INTEGER DEFAULT 2; > > PREPARE Stmt FROM > 'select Datum + interval ''' + cast(Delta as varchar) + ''' month as > NewDateField from Kalender'; > OPEN Result; > > END > > Uli > |
Mon, May 28 2012 6:27 AM | Permanent Link |
Uli Becker | Sorin,
> I need the state in a query not in a script. > > edbQuery.sql.text := 'select Datum + interval ''' + cast(Delta as varchar) > + ''' month as... > > Does it make any difference? It's the same: just compose the statement like this: with MyQuery do begin sql.add('select Datum + interval ''' + IntToStr(MyIntValue) + ''' month as NewField from Kalender'); open; end; Uli |
Page 1 of 4 | Next Page » | |
Jump to Page: 1 2 3 4 |
This web page was last updated on Thursday, July 4, 2024 at 06:12 AM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |