473,390 Members | 1,476 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,390 software developers and data experts.

Trying to create a Update query to update data from one table to another

I have multiple entries in one table that I need to update the entries in the current production table with, to revert that data back before a migration so I can migrate that data again.

The queries I wrote to find the entries that need to be updated is below. There are four queries that I ran to find the information. There is a total of about 2500 lines that need to be updated.

Select * from St_Page
where fname like '01-%'

Select * from St_Page
where fname like 'h8%'

Select * from St_Page
where fname like 'h9%'

Select * from St_Page
where fname like 'ha%'


I checked the two tables and there are a total of 9 fields. 4 need to be updated the other 5 stay the same. The fields that need to be updated are VOLNAME, ADDDATE, SECTOR, and EXTID.

I am guessing I want to use the FNAME field to find the objects to update. Any ideas on how to write this update query. Both St_Page tables will be in the same instance of SQL but in different databases.
Mar 4 '08 #1
2 1686
amitpatel66
2,367 Expert 2GB
I have multiple entries in one table that I need to update the entries in the current production table with, to revert that data back before a migration so I can migrate that data again.

The queries I wrote to find the entries that need to be updated is below. There are four queries that I ran to find the information. There is a total of about 2500 lines that need to be updated.

Select * from St_Page
where fname like '01-%'

Select * from St_Page
where fname like 'h8%'

Select * from St_Page
where fname like 'h9%'

Select * from St_Page
where fname like 'ha%'


I checked the two tables and there are a total of 9 fields. 4 need to be updated the other 5 stay the same. The fields that need to be updated are VOLNAME, ADDDATE, SECTOR, and EXTID.

I am guessing I want to use the FNAME field to find the objects to update. Any ideas on how to write this update query. Both St_Page tables will be in the same instance of SQL but in different databases.
Are you looking at updating a table of one database with a table of another database? In taht case you will need to use databse link to connect both the databases and do an update.
Mar 4 '08 #2
Yes I am going to import the data for the ST_page table before the migration into the SQL instance as a different database. I do not want to interfer with the production database. I do need to update the ST_page table in the production database with the ST_page table information from before the migration which I thought the best way was to import that table into a different database. Both tables with then be in the same instance of SQL just not in the same database. I don't know how to create the update or the connection you are talking about. Any help would be greatly appreciated.
Mar 4 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: kalamos | last post by:
This statement fails update ded_temp a set a.balance = (select sum(b.ln_amt) from ded_temp b where a.cust_no = b.cust_no and a.ded_type_cd = b.ded_type_cd and a.chk_no = b.chk_no group by...
1
by: poohnie08 | last post by:
i have a excel spreadsheet showing staff name, date,work hour, ot hour, slot1, slot2, slot3, slot4 and others). The "()" will keep repeating from day 1 until end of month. eg in excel spreadsheet,...
8
by: Maxi | last post by:
There is a lotto system which picks 21 numbers every day out of 80 numbers. I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21) Here is the structure and sample data: ...
1
by: rdemyan via AccessMonster.com | last post by:
My application has a table that contains information on buildings. The building data comes from another database and is imported from a spreadsheet into my application. Originally, I thought...
5
by: kkddrpg | last post by:
the database looks like this the database is called username_tpp (not really just using username as a sub) the table is called home it has field 1 : varchar(50) | latin1_swedish_ci | no...
3
by: eholz1 | last post by:
Hello PHP programmers. I had a brilliant idea on one of my pages that selects some data from my mysql database. I first set the page up to display some info and an image, just one item, with a...
15
by: Killer42 | last post by:
Hi all. Ok, I'm using VB6 but I think the answer to this (if there is one) is more likely to be found in the Access forum. I have a situation where I've got tens of millions of records, spread...
16
by: ARC | last post by:
Hello all, So I'm knee deep in this import utility program, and am coming up with all sorts of "gotcha's!". 1st off. On a "Find Duplicates Query", does anyone have a good solution for...
1
by: Landon | last post by:
Ver: Access 2003 Hi everyone and thanks in advance, General Issue: I want to make a table whose data polls from two other tables and will update (add new records) if additions are made to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...

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.