473,800 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Importing multiple files

Hi,
I have to import hundreds of file to MySQL database. Is it
possible to write a script/storedprocedure in MySQL that does this
without manually doing it for each file.
Say file names are of type 'file0001.txt', 'file0002.txt' etc. Does
MySQL provide any such utility or does anyone know of a free utility?.
If not then what is best language to write such a script/program. Cant
such a script be written in PHP easily?

Thx.
Dec 9 '07 #1
4 1367
NC
On Dec 8, 9:53 pm, myGoogle71 <ali...@sunnipa th.comwrote:
>
I have to import hundreds of file to MySQL database.
....
Say file names are of type 'file0001.txt', 'file0002.txt' etc.
....
Cant such a script be written in PHP easily?
Yes.

Cheers,
NC
Dec 9 '07 #2
On Sun, 09 Dec 2007 06:53:29 +0100, myGoogle71 <al****@sunnipa th.com>
wrote:
Hi,
I have to import hundreds of file to MySQL database. Is it
possible to write a script/storedprocedure in MySQL that does this
without manually doing it for each file.
Say file names are of type 'file0001.txt', 'file0002.txt' etc. Does
MySQL provide any such utility or does anyone know of a free utility?.
If not then what is best language to write such a script/program. Cant
such a script be written in PHP easily?
Easily written. Check the glob() function in PHP & de LOAD_FILE() function
in MySQL.
--
Rik Wasmus
Dec 9 '07 #3
myGoogle71 wrote:
Hi,
I have to import hundreds of file to MySQL database. Is it
possible to write a script/storedprocedure in MySQL that does this
without manually doing it for each file.
Say file names are of type 'file0001.txt', 'file0002.txt' etc. Does
MySQL provide any such utility or does anyone know of a free utility?.
If not then what is best language to write such a script/program. Cant
such a script be written in PHP easily?

Thx.
As Rik indicated, this is very easily done in PHP. But if you're
looking how to do it in MySQL, you're in the wrong group - you want
comp.databases. mysql.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Dec 9 '07 #4
Jerry Stuckle wrote:
myGoogle71 wrote:
>Hi,
I have to import hundreds of file to MySQL database. Is it
possible to write a script/storedprocedure in MySQL that does this
without manually doing it for each file.
Say file names are of type 'file0001.txt', 'file0002.txt' etc. Does
MySQL provide any such utility or does anyone know of a free utility?.
If not then what is best language to write such a script/program. Cant
such a script be written in PHP easily?

Thx.

As Rik indicated, this is very easily done in PHP. But if you're
looking how to do it in MySQL, you're in the wrong group - you want
comp.databases. mysql.
Oops - I didn't look for a crosspost :-(. My bad.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Dec 9 '07 #5

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

Similar topics

2
2745
by: steve | last post by:
Hi, I have researched but have not found a good solution to this problem. I am importing large amounts of data (over 50 Meg) into a new mysql db that I set up. I use >mysql dbname < importfile.txt But I keep getting timeouts and errors due to the data being too large. I know that since if I break the imported data into multiple chuncks (by importing a few tables at a time) then everything works.
4
2722
by: Indra | last post by:
Hi There, I am looking for information on how to import the txt or csv file to the multiple table in sql 2000. If you have any kind of inf. please let me know wheather we can do this and how. below is the detail information. I received txt file every day which contain the information from 3 different related table in my sql 2000 database. Right now we are
1
2238
by: Steve George | last post by:
Hi, I have a scenario where I have a master schema that defines a number of complex and simple types. I then have a number of other schemas (with different namespaces) where I would like to reuse some of these master complex and simple types. This I believe will assist me in transforming between the master schema and the other smaller schemas that contain a subset of the elements in the master schema. I understand that I can import an...
2
1825
by: Regnab | last post by:
Just chasing a few ideas for a suitable loop for importing multiple text files. Up until now I have used a Do While Len(strfile) > 0 and moved each file to a different folder after being imported. However this time I want to keep them in the same folder and this loop obviously just goes around in circles. Just wondering what people would use in this situation? Cheers Reg
5
2173
by: Mike Collins | last post by:
I am trying to export data from multiple tables in SQL Server to an XML file so I can then import it to another database. It seems to be working fine for exporting, but I am having trouble importing the file. I am getting the following error trying to import the same xml file I just exported. "System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near 'GetTprsForExport'. Can someone show me where I am going wrong. Even though I say...
3
3355
by: mukeshsrivastav | last post by:
dear sir i want to move form excel to access. i have 5 excel file having same formats and fields.now i want to import all data in one access table. importing one file is easy .but importing and appending second file in last of the access table created earlier by importing data. thanks .plz help me.
4
4449
by: JamesSykes | last post by:
Hi, I am relatively new to Access and VBA. I am trying to import a number of database files (just really want the contents of their tables) from a specified folder into a master table that contains all records and is updated periodically (via imports). I have tried using a batch process (this limits me to importing specified files) but ideally would like to be able just to import all databases (or just their respective tables) irrespective...
28
19260
by: kkadakia | last post by:
I get a daily excel file for a entire month which I want to transfer into Access at the end of the month. So, there are around 20-25 excel files I get by the end of the month, and I would like to import them into Access using a button. The data contained in the excel files is similar, so there should no formatting issues while importing. I searched through the forums and found the code by mmccarthy for importing excel files. I tried using...
7
7136
by: cannunzi | last post by:
I'm trying to import multiple files in one access table all at once but i keep hitting an error stating incorrect file path. The code below works when i change the * to the exact file name but then it only imports the one file. I would like the code to import all files in the folder into the table. Any suggestions? Sub FuelTaxImport() DoCmd.TransferSpreadsheet acImport, , _ "FuelTaxReport", "C:\FuelTaxReports\*.xls", True,...
2
4454
by: ciaran.hudson | last post by:
Hi I have multiple excel files of the same format in a directory. They are called book1.xls, book2.xls, book3.xls and so on. What is the easiest way to import the tab named sheet1 from each of the excel files to a databse using SQL server 2000 enterprise edition? Regards, Ciarán
0
9551
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,...
1
10255
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
10036
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9092
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
7582
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
5473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2948
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.