472,146 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 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 1585
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

Post your reply

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

Similar topics

17 posts views Thread by kalamos | last post: by
1 post views Thread by rdemyan via AccessMonster.com | last post: by
reply views Thread by leo001 | last post: by

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.