Sql updating multiple rows from another table
In case of this example, I want the Date_Enrollment values to be written into the werte table.Let's say I have 3 users I want to do this for, then the structure for THKON01looks like this: I want them to be inserted so that the first value of THKON01() gets copied to the first value in werte (field of folder_id 1525), the second () gets to the second (folder_id 1526), and so forth.regards & thanks pjp June 29, 2005 - am UTC select as many old columns as you want and as many new columns as you want??? But when i did the same with the syntax given i got this error ora-01779 cannot modify a column which maps to a non key preserved value. I tried doing the same through this update ( select old. WORKEXTENSION from TBL_VOTERS old, VOTERSWITHNUMBERS new where old. Parameterized Queries are my preferred way of going.I'm using MS-SQL Server 2005 EDIT: Closing, and re-asking as EDIT: Re-opened, as this appears to be a popular question // make one of these for each row String. etc I have a mapping table where "ALL" old account number and new account numbers are present. But Sales Supplier, Purchase supplier, Wholesale Supplier ..many other columns how can i update in single SQL ( I have to update around 70 columns and some columns may have null values such as Purchase supplier ..) 2. You need to have the table you are updating from have a unique or primary key constraint.
I'm absolutely not proficient with bash scripting so this script could be not working, but I hope that the idea is clear.The CTE result set is derived from a simple query and is referenced by UPDATE statement.Common table expressions can also be used with the SELECT, INSERT, DELETE, and CREATE VIEW statements. For information about table hints, see , 'expression' should be prefixed with the capital letter 'N'.Here is a look back at those years, and here's to the next 40! Hi Tom, Due to migration to new system we have to change all our account numbers. June 28, 2005 - pm UTC yes, the predicate in the join for the fictional question without a sample table and data was wrong (everytime I wing it, try to answer WITHOUT TESTING, it comes out wrong. test cases are relevant :) Hi Tom, Thanks for answering my question. ( Client number is consist of branch, Number, Sub Number Currency Code ) We have one big transaction table around 1 million records, having many columns, and at many places client numbers are stored from account master under various columns 1. You told me to use update ( select old.old_account_number, new.new_account_number from old_table old, mapping_table new where old.old_account_number = new.old_account_number ) set old_account_number = new_account_number; But I think my questions still reamin unanswered 1. In your answer only one number say client number will get updated.
In 40 years, there's been some amazing functionality in the database. I want to write SQL ( not PL/SQL ) to update transaction table from mapping table at one stroke. regards & thanks pjp update ( select old.old_account_number, new.new_account_number from old_table old, mapping_table new where old.old_account_number = new.new_account_number ) set old_account_number = new_account_number; disabling foreign keys during the operation and enabling them afterward. update ( select old.old_account_number, new.new_account_number from old_table old, mapping_table new where old.old_account_number = new.old_account_number ) set old_account_number = new_account_number; (ie in the subquery, match the old account numbers not try matching the old in the old table to the new in the mapping table) Of course if the original posting had the CREATEs/INSERTS etc, it would have a quick and east test.