Bruce Momjian wrote:
> Karen Hill wrote:
> > >From Access I'd like to run pass the following from MS Access to
> > PostgreSQL 8.1 using VBA:
> >
> > BEGIN;
> > UPDATE accounts SET balance = balance + 100.00 WHERE acctnum = 12345;
> > UPDATE accounts SET balance = balance - 100.00 WHERE acctnum = 7534;
> > COMMIT;
> >
> > It won't let me. Any ideas solutions?
>
> What error does it show?
>
Error on character 7.
I suspect it only allows one SQL statement to go through and thinks
everything after the BEGIN; is an error. I thought of creating a
function in pl/pgsql that would allow me to do this. Something like
this in postgresql: NOTE:pseudocode
function(sql_statement_1, sql_statement_2){
BEGIN;
sql_statement_1;
sql_statement_2;
COMMIT;
}
And then I'd run that function from access: NOTE:pseudocode
DoCmd.RunSQL "function('UPDATE accounts..WHERE acctnum = 12345',
'UPDATE accounts...WHERE acctnum = 7534')"