Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Replication (2005)
 Merge/Sync - What type of replication?

Author  Topic 

datadrum
Starting Member

3 Posts

Posted - 2009-04-27 : 10:58:30
Greetings everyone. I am not sure if this is the right forum topic to post this under. If it isn't, please direct me accordingly.

What type of replication or SQL Server tool would best fit this situation/problem:

I have Database A that we have a front end app writing too. This app wrote data up till a date, I'll use May 1st as an example. Somewhere down the line we setup another front end app that is now writing to Database B. So, I have data on Database A up till May 1st. After May 1st, the front end starts writing to Database B.

What SQL Server 2005 tool/solution would be best so that I can bring the data from database A into database B? or merge the databases so that whatever is missing is replicated over?

Many thanks!

DavidD
Yak Posting Veteran

73 Posts

Posted - 2009-05-04 : 23:04:14
I would just write a routine that loops through the tables and copies the info from Database A to Database B

something like:

declare @tablename varchar(50)
declare @sql varchar(1000)
select name into #tmp from sysobjects where type = 'u'
while exists(select name from #tmp)
begin
set @tablename = (select max(name) from #tmp
set @sql = 'insert into DatabaseB.dbo.' + @tablename + ' select * from DatabaseA.dbo.' + @tablename
exec(@sql)
delete from #tmp where name = @tablename
end
drop table #tmp

Alternatively if you want a tool to perform this task, SQLDelta works well - look it up on the web

Regards
David
Go to Top of Page
   

- Advertisement -