List:MySQL ODBC« Previous MessageNext Message »
From:Daniel Kasak Date:January 13 2005 9:09pm
Subject:Re: Sending multiple SQL statements
View as plain text  
Benoit St-Jean wrote:

> Ionut Gorea wrote:
>
>> I’am using MyODBC 3.51.10 on a Win 98 SE system and I tried to send 
>> with Visual Fox Pro 8 a query like:
>>
>> INSERT INTO table SET field1=’value’; SELECT LAST_INSERT_ID()
>>
>> and it doesn’t work.
>>
>> Can’t be send through the odbc driver multiple SQL statements in one 
>> string?
>>
>> Thanks
>>
>> Ionut
>>
>
> Wrong syntax!
>
> INSERT INTO tablename (col1name, col2name, col3name) VALUES 
> (valuecol1, valuecol2, valuecol3);
>
> UPDATE tablename SET colname1 = value1, colname2 = value2 WHERE 
> whereclause


That syntax actually *does* work, and it's pretty handy too - it's the 
same syntax as an update command, so you can use the same logic to 
script an update as you can to script an insert. Mostly the same anyway.

The problem is that MyODBC-3.51.x doesn't support multiple statements. 
The mysql console *does* support multiple statements like this, but I 
believe we have to wait for MyODBC-3.53.x before we can do it via ODBC.

Dan

-- 
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak@stripped
website: http://www.nusconsulting.com.au

Thread
Sending multiple SQL statementsIonut Gorea13 Jan
  • Re: Sending multiple SQL statementsBenoit St-Jean13 Jan
    • RE: Sending multiple SQL statementsIonut Gorea13 Jan
    • Re: Sending multiple SQL statementsDaniel Kasak13 Jan
RE: Sending multiple SQL statementsArmin Schöffmann13 Jan