473,698 Members | 2,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple sql statements in insert query

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.

Nov 13 '05 #1
3 17918
On 11 Jul 2005 13:24:31 -0700, kr***********@g mail.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,
TransferDatabas e).
Then write insert statements like this:
insert into AccessTable(<fi eldnames>)
select <fieldnames> from MySqlTable

This will bulk-insert the data.

-Tom.

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.


Nov 13 '05 #2
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.

Nov 13 '05 #3
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 ...

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
7385
by: Jack | last post by:
I have a text file of data in a file (add2db.txt) where the entries are already entered on separate lines in the following form: INSERT INTO `reviews` VALUES("", "Tony's", "Lunch", "Great atmosphere. Good food.", " (Harry Houdini - 03/01/2004)"); INSERT INTO `reviews` VALUES("", "Le Chow Place", "Lunch", "yada yada", " (Herbert Hoover - 03/03/2004)"); INSERT INTO `reviews` VALUES("", "Golden Dragon", "Lunch", "Exquisite.
8
5519
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE, UPDATE, DELETE) which are controlled by a web frontend and the table records are manipulated to control the permissions. Example: The Press Release section record would look like this: Username: John Doe Function Name: Press Release
3
1523
by: Dean g | last post by:
Hi, I have a problem with running multiple sql statements using asp. Basically if there is an error with any of the statements inside the query a rollback is done. the sql and rollback work fine, But on the actual asp page no error is detected unless it occurs in the first statement in the query. heres an example <% Sql= " BEGIN TRAN INSERT INTO Users VALUES ('BLAH', 'BLAH') INSERT INTO TESTING VALUES ('SOMETHING','SOMETHING') IF @@error...
4
16754
by: DG | last post by:
Hi, Can anyone advise how to execute multiple statements in a single query batch. For example- update customers set customer_name = 'Smith' where customer_name = 'Smyth'; select * from customers; I can execute each statement individually but get the 'you have an error in
5
6170
by: Arsen V. | last post by:
Hello, What is the optimal way to insert multiple rows (around 1000) from a web application into a table? The user enters multiple lines into a text box (up to 10,000). The ASP.NET application breaks that data into a string array. Each line is an item of that array. The user clicks Submit.
5
3063
by: mimo | last post by:
Hello, I have seen samples on how to pull data from one table and save back to it using the Form View control. How do I pull from multiple tables and save back to multiple tables on one screen? Is there a sample of this somewhere? For example I want to create a Name and an Address from one screen. It has to create a Name Record, a Name Address Record, and a NameAddressJoin Record.
2
2935
by: Diego | last post by:
Hi everybody! I'm using DB2 PE v8.2.3 for linux. I've defined a database with the following schema: ANNOTATION(ID,AUTHOR,TEXT) ANNOTATION_BOOK(ANNOTATION_ID,OBJECT_ID) BOOK(ID,AUTHOR,TITLE). Between the book and annotation entities there is a many-to-many
5
12261
by: alingsjtu | last post by:
Hello, every body. When execute dynamic generated multiple OPENQUERY statements (which linkes to DB2) in SQLServer, I always got SQL1040N The maximum number of applications is already connected to the database. SQLSTATE=57030. Background: I created a linked server to DB2 8.1 database which called GRR_DB2Server. In my stored procedure p_FetchRawData, I need to read some data from this linked server GRR_DB2Server and insert them into
9
4999
by: Mohd Al Junaibi | last post by:
Hello all, my first post here...hope it goes well. I'm currently working on stored procedure where I translated some reporting language into T-SQL The logic: I have a group of tables containing important values for calculation. I run various sum calculations on various fields in order to retrieve cost calculations ...etc.
0
8612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7743
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6532
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.