Subject | Re: Duplication records |
---|---|
Author | Leeway |
Post date | 2001-07-08T07:45:01Z |
svein,
I tried this but got errors in the prepare.
'Token unknown EMP'
What is wrong with this statement ?
The where statement on its own works.
QTIB_Pim.SQL.Clear;
QTIB_Pim.SQL.Add('insert into PIM EMP,DATE_START,DATE_END,PIMAGE');
QTIB_Pim.SQL.Add('select EMP,DATE_START + :DaysToMove,DATE_END
+ :DaysToMove,PIMAGE from PIM');
QTIB_Pim.SQL.Add('where DATE_START >= ' + Date_Start_String + ' and
DATE_START <= ' + Date_End_String);
QTIB_Pim.SQL.Add('parambyname(:daystomove).AsInteger := 2;');
QTIB_Pim.Prepare;
QTIB_Pim.Execute;
Thanks aforehand
Lee
--- In ib-support@y..., Svein Erling Tysvær
<svein.erling.tysvaer@k...> wrote:
I tried this but got errors in the prepare.
'Token unknown EMP'
What is wrong with this statement ?
The where statement on its own works.
QTIB_Pim.SQL.Clear;
QTIB_Pim.SQL.Add('insert into PIM EMP,DATE_START,DATE_END,PIMAGE');
QTIB_Pim.SQL.Add('select EMP,DATE_START + :DaysToMove,DATE_END
+ :DaysToMove,PIMAGE from PIM');
QTIB_Pim.SQL.Add('where DATE_START >= ' + Date_Start_String + ' and
DATE_START <= ' + Date_End_String);
QTIB_Pim.SQL.Add('parambyname(:daystomove).AsInteger := 2;');
QTIB_Pim.Prepare;
QTIB_Pim.Execute;
Thanks aforehand
Lee
--- In ib-support@y..., Svein Erling Tysvær
<svein.erling.tysvaer@k...> wrote:
> Hi Lee,statement.
>
> INSERT INTO PIM (listoffieldstoinsert)
> SELECT somefields, DATE_START + :DaysToMove, morefields
> FROM PIM
> WHERE keyfield = :SomeValue
> Prepare the statement, set the parameters
> (ParamByName(:DaysToMove).AsInteger:=something;) and execute the
>duplicate
> Simple and easy,
> Set
>
> >In a database I got appointments with a timestamp field.
> >How can I duplicate a specific appointment to another date ?
> >So suppose I got a appointment on 2001/01/01 and I want to
> >this appointment to 2001/02/01 how do I write a sql command forthis ?
> >The appointment fields are the same, only the timestamp field is(Days_To_Move)
> >different.
> >I know how to move :
> >('update PIM set DATE_START = DATE_START + ' + IntTostr
> >+ ' where DATE_START = ' + Date_Start_String);
> >But what is the syntax for duplicating a record?