473,671 Members | 2,251 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mass updates to a table

I've got a web-based form that will allow people to update a database
that is displayed as a table. Let's say that there are several columns
across titled Red, Blue, Green... and several rows titled 01, 02, 03...
In each cell, they can fill in some simple text data.

The only way that I can think of to update the database with this
information is using two imbedded loops in Perl:

pseudocode:
for($color=1;$c olor<=10;++$col or) {
for($number=1;$ number<=10;++$n umber) {
update table xyz set value=$value[$color][$number]
where color=$color and number=$number;

This would mean that it would have to execute 100 update statements.
Perhaps this is no big deal and I shouldn't worry about it, but since
I'm relatively new to sql, I'm guessing that there's probably a more
streamlined method to do this.

BTW - I've seen a lot of people asking questions that were vaguely
similar to mine in this group, and they've been told to go to the php
group, even though I didn't see any php-specific code in their
questions. I don't use php and don't have it installed on my server.

Jul 19 '05 #1
2 2999
Pat Traynor wrote:
The only way that I can think of to update the database with this
information is using two imbedded loops in Perl:

pseudocode:
for($color=1;$c olor<=10;++$col or) {
for($number=1;$ number<=10;++$n umber) {
update table xyz set value=$value[$color][$number]
where color=$color and number=$number;


If $value[$color][$number] has different values (as it seems to have in
this case), then this is propably the only way to do this.

Of course you could add some checking whether the data has changed or
not, and run update only for those rows where data has changed.

If you need to set same value to each row, it would be of course easy
just to run query: update xyz set value=same_valu e;

Jul 19 '05 #2
Pat Traynor wrote:
The only way that I can think of to update the database with this
information is using two imbedded loops in Perl:

pseudocode:
for($color=1;$c olor<=10;++$col or) {
for($number=1;$ number<=10;++$n umber) {
update table xyz set value=$value[$color][$number]
where color=$color and number=$number;


If $value[$color][$number] has different values (as it seems to have in
this case), then this is propably the only way to do this.

Of course you could add some checking whether the data has changed or
not, and run update only for those rows where data has changed.

If you need to set same value to each row, it would be of course easy
just to run query: update xyz set value=same_valu e;

Jul 19 '05 #3

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

Similar topics

1
3129
by: Chris | last post by:
Has anyone ever accomplished a mass update off all databases, tables and columns for collation? If I try to change the collation/character set for the mysql daemon it breaks all of our queries because they conflict with the swedish default that they have been created with. The problem is we have about 90 databases with hundreds of tables. Is there an easy way to update all of these at once and that would allow me to start with the...
1
1862
by: kartik | last post by:
Hi , I am in need to find a way, to mass copy the data from db2 table running in mainframe to universal database db2 on NT. I know that DB2 connect gives the flexiblity of connecting and communicate the db2 application running in mainframe. but i want to know that whether i can do mass transfer data between the two system . i like to do as a night job that runs for many hrs.I like to know any protocol is used for such connectivity and...
5
3808
by: Hunter Hillegas | last post by:
I have a CSV file with 400,000 lines of email mailing list information that I need to migrate to a new PostgreSQL database. Each line has all the info I need except a PK (I usually use an int4 column for a PK). If the file were smaller I would probably just use Excel to pop in a PK and then just load into the table... Since Excel chokes on files greater than 65k lines, this won't work.
4
1705
by: T.H.N. | last post by:
I'm trying to work out a database design to make it quicker for my client program to read and display updates to the data set. Currently it reads in the entire data set again after each change, which was acceptable when the data set was small but now it's large enough to start causing noticable delays. I've come up with a possible solution but am looking for others' input on its suitability to the problem. Here is the DDL for one of the...
2
1586
by: Bac2Day1 | last post by:
I've got a table located on my website and localhost. The table maintains a size of about 200MB. The table holds a running 4 weeks of data (50MB/week). I have a winapp that updates my localhost db each week and currently, I run a backup on the table using the MySql Administrator... then I run restore on my website's mysql server. This deletes the whole table and reinserts each row. This isn't needed and is a long process. Is there a...
1
2002
by: teo | last post by:
Hallo, I'm performing a mass insertion from a text file to a db table with AdoNet commands, like this: myCommand.CommandText = "BULK INSERT ..." from a Win form no problem
2
4309
by: paulmac106 | last post by:
Hi, I need to update a field in about 20 records on a table. The table has an update trigger (which updates the field whenever a record is updated). As a result I'm getting an error: "Subquery returned more than 1 value.", and the update fails. Is there a way in the stored procedure to handle this issue? thanks for your help.
4
4990
by: wrldruler | last post by:
Hello, First, I know it's against "Access Law" to save calculations in a table, but....I want/need to. I currently have sub-totals being calculated inside a form, using DMax, DCount, and DSum. But these aggregate functions are slowing down the interface and annoying me. So I have decided not to show sub- totals on the form.
1
4999
by: Michel Esber | last post by:
Linux Db2 LUW V8 FP 15 I was readiong Serge´s SQL on Fire presentation (part 2), and there is a slide that shows how to mass delete data using procedures. Something like: loop: LOOP DELETE FROM (SELECT 1 FROM Table WHERE InvDate <= dt FETCH FIRST 1000 ROWS ONLY) AS D; IF SQLCODE = 100 THEN LEAVE loop;
0
8821
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8598
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
8670
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
7437
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
6229
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
4225
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
4407
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2812
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
2
2051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.