Mega Search
23.2 Million


Sign Up

Make a donation  
Tibdataset:ModifySQL update two or more tables  
News Group: embarcadero.public.delphi.database.interbase_express

Hello,

is there a way of updating more than one table in ModifySql?

If I try to do something like:
{code}
Update table1
 set a = 1
where id = old_id;
Update table2
  set b = 2
 where id_2 = old_id_2;
{code}

I get an error.
I only can do one update statement.

Anybody an idea?

Thanks in advance.

Andreas

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 15-Jul-2014, at 11:34 PM EST
From: Andreas Sibbus
 
Re: Tibdataset:ModifySQL update two or more tables  
News Group: embarcadero.public.delphi.database.interbase_express
Andreas Sibbus wrote:
> Hello,
> 
> is there a way of updating more than one table in ModifySql?
> 
> If I try to do something like:
> {code}
> Update table1
>  set a = 1
> where id = old_id;
> Update table2
>   set b = 2
>  where id_2 = old_id_2;
> {code}
> 
> I get an error.
> I only can do one update statement.
> 
> Anybody an idea?
> 
> Thanks in advance.
> 
> Andreas

Not directly. You will need to add an OnUpdaterecord event and use an IBSQL(s) 
dto do the updating and execute different SQL when the event is Modify.

The other alternative is to write a stored procedure that does your update and 
pass all the fields to it.

While I have planned to add scripting capabilities to the insert/modify/delete 
SQL, I have not gotten around to it so they are all single statement items (no 
won't be added for XE7 either).

-- 
Jeff Overcash (TeamB)
       (Please do not email me directly unless  asked. Thank You)
And so I patrol in the valley of the shadow of the tricolor
I must fear evil. For I am but mortal and mortals can only die.
Asking questions, pleading answers from the nameless
faceless watchers that stalk the carpeted  corridors of Whitehall.
              (Fish)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 16-Jul-2014, at 9:15 AM EST
From: Jeff Overcash (TeamB)