Perfect IT Solutions, India 
Welcome to Perfect Solution by Prakash Samariya 
If your data is divided into different database(s) and you need to update your main databse using those data from different database(s).
 
Let us assumes that, your main database Name is MainDatabase, and your other database(s) are likeClientDataBase1ClientDataBase2 (We will call all those database as client database).
 
Following are the simple steps to update the table from the different database(s).
 
Step1
=========
 
select PK_ID,COL_to_CHANGE
INTO [MainDatabase].[dbo].[TempTable]
from
(
select PK_ID,COL_to_CHANGE from [ClientDataBase1].[dbo].[audio_master]
 union all
select PK_ID,COL_to_CHANGE from [ClientDataBase2].[dbo].[audio_master]
) as b
 
This will create the Table named [TempTable] and insert all the results from the select statements
 
Step2
=========
 
UPDATE  F
SET F.COL_to_CHANGE= X.COL_to_CHANGE
from [MainDatabase].[dbo].[TempTable] X INNER JOIN[MainDatabase].[dbo].[TempTableF] F
ON X.PK_ID=F.PK_ID
 
 
 
IF [TempTable] is already available in [MainDatabase], use the following step instead of step1
 
Delete * from [MainDatabase].[dbo].[TempTable]
 
Insert into [MainDatabase].[dbo].[TempTable] (PK_ID,COL_to_CHANGE)
 
 
select * from
(
select PK_ID,COL_to_CHANGE from [ClientDataBase1].[dbo].[audio_master]
 union all
select PK_ID,COL_to_CHANGE from [ClientDataBase2].[dbo].[audio_master]
) as b
 
 
0 commentsFilled under: Database
Hi,

Welcome to my blog. This is my introductory post to introduce myself. In this blog you will find the numerous new things related to IT fields. Definitely you will enjoy the blog with accessing this blog.
0 commentsFilled under: General
 
 
Author
Prakash Samariya is an IT Professional. He has 10+ years of experience in various domains with his expertise.

Archive

Categories

RSS feed