dbTalk Databases Forums  

Multiple sql statements in insert query

comp.databases.ms-access comp.databases.ms-access


Discuss Multiple sql statements in insert query in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
kristof.loots@gmail.com
 
Posts: n/a

Default Multiple sql statements in insert query - 07-11-2005 , 03:24 PM






Hi all,

Somehow I want to transfer data from an mysql database on the web to an
local offline access database. Note: tables and types do not match.
So, I toughed, generating sql commands to insert the data would do the
trick. But, unfortunately it works only properly for 1 record.

This is what I do (suggestions are more than welcome)
Create a new query, skip all the wizard-stuff and choose sql-view. Then
I past my dozen sql commands in their. Like:
INSERT INTO RunnerInfo ( RunnerID, FirstName, LastName, BirthDate,
Gender, ClubName, RaceID ) VALUES (10, 'me', "too", ' 01/01/1900', "M",
"city", 2);
INSERT INTO RunnerInfo ( RunnerID, FirstName, LastName, BirthDate,
Gender, ClubName, RaceID ) VALUES (11, 'me', "not", ' 31/12/1980', "M",
"city", 2);
....

When I try to save this query, I get: "Characters found after end of
SQL statement." This just means that only 1 command is allowed (leaving
only 1 command in their shows this).

How can I solve this problem and execute multiple sql commands in
batch? I have seen the import sql option but I does not read sql
commands, It wants to connect to a database, which is, in my case, not
possible.


Reply With Quote
  #2  
Old   
Tom van Stiphout
 
Posts: n/a

Default Re: Multiple sql statements in insert query - 07-11-2005 , 10:01 PM






On 11 Jul 2005 13:24:31 -0700, kristof.loots (AT) gmail (DOT) com wrote:

Find a decent ODBC driver for MySql.
Using it, create an ODBC data source, and using it, attach the MySql
tables to your Access app (keywords: Connect, RefreshLink,
TransferDatabase).
Then write insert statements like this:
insert into AccessTable(<fieldnames>)
select <fieldnames> from MySqlTable

This will bulk-insert the data.

-Tom.


Quote:
Hi all,

Somehow I want to transfer data from an mysql database on the web to an
local offline access database. Note: tables and types do not match.
So, I toughed, generating sql commands to insert the data would do the
trick. But, unfortunately it works only properly for 1 record.

This is what I do (suggestions are more than welcome)
Create a new query, skip all the wizard-stuff and choose sql-view. Then
I past my dozen sql commands in their. Like:
INSERT INTO RunnerInfo ( RunnerID, FirstName, LastName, BirthDate,
Gender, ClubName, RaceID ) VALUES (10, 'me', "too", ' 01/01/1900', "M",
"city", 2);
INSERT INTO RunnerInfo ( RunnerID, FirstName, LastName, BirthDate,
Gender, ClubName, RaceID ) VALUES (11, 'me', "not", ' 31/12/1980', "M",
"city", 2);
...

When I try to save this query, I get: "Characters found after end of
SQL statement." This just means that only 1 command is allowed (leaving
only 1 command in their shows this).

How can I solve this problem and execute multiple sql commands in
batch? I have seen the import sql option but I does not read sql
commands, It wants to connect to a database, which is, in my case, not
possible.


Reply With Quote
  #3  
Old   
kristof.loots@gmail.com
 
Posts: n/a

Default Re: Multiple sql statements in insert query - 07-13-2005 , 09:37 AM



I don't quite understand. Does it mean that the ODBC driver needs to be
installed on the server with the mysql server? or with access?
Anyway, I can't install this on the server with mysql.


Reply With Quote
  #4  
Old   
kristof.loots@gmail.com
 
Posts: n/a

Default Re: Multiple sql statements in insert query - 07-25-2005 , 09:00 AM



All thankx for your help.
I have created a ; - separated file with php and then I import this in
access and it works fine.
Easy as it can be ...


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.