By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,946 Members | 1,714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,946 IT Pros & Developers. It's quick & easy.

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

P: 2
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
Share this Question
Share on Google+
2 Replies


amitpatel66
Expert 100+
P: 2,367
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

P: 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.