Groups | Blog | Home
all groups > sql server (microsoft) > june 2006 >

sql server (microsoft) : Would replication work here?


mkerrigan NO[at]SPAM ktoys.com
6/26/2006 12:48:46 PM
I have two databases on the same server. I want to populate and keep
synchronized a table on database 2 from a view on database 1. Whenever
data would change in the underlying tables on database 1, it would
update the table on database 2. Is this something that can be done
through replication or should I use a DTS? Thing is, we want it to be
as close to real-time as possible. I know what I'm trying to do
doesn't seem to make much sense, but it's too long to get into here. I
just need an answer to the underlying problem, thanks!
Andrew La Grange
6/27/2006 12:26:40 AM
Hey.

If it is always going to be on the same database server you could just
create a view on Database B, that pulls from the view on Database A; in
which case it would be realtime and there would be no need for
replication or DTS (which would be overkill for this situation).

Would look something like this:

CREATE VIEW [DatabaseB].[dbo].[vDestinationView]
AS
SELECT * FROM [DatabaseA].[dbo].[vSourceView]
GO

Other quick and easy ways to go would be an IF NOT EXISTS INSERT INTO
job running on the SQL Agent as often as you need the data moved over,
but that is a bit nasty.

Hope this helps.

Andrew la Grange
-------------------------------------
BUSINESS ARTISTS
Systems / Solutions / Consulting
Web: http://www.businessartists.co.za
-------------------------------------



[quoted text, click to view]
Jens
6/27/2006 1:16:36 AM
The manual way would be to use a trigger on those tables. The efficient
way would be to use replication.

HTH, Jens Suessmeyer.

---
http://www.sqlserver2005.de
---
mkerrigan NO[at]SPAM ktoys.com
6/27/2006 7:01:08 AM
I know that the view is the obvious way. What I'm not telling you is
that this data actually needs to reside in tables in Database B. The
reason for this is, some of the data in these tables in Database B is
going to be input manually and some is coming from Database A. So it
has to be in the tables, not a view. The application that is being
designed needs to accommodate data entry into these tables as well as
importing from another database.

[quoted text, click to view]
AddThis Social Bookmark Button