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
 Transact-SQL (2005)
 upon trigger: insert in table in other database?

Author  Topic 

Pherkad
Starting Member

23 Posts

Posted - 2007-03-29 : 08:59:21
hi

i have one central server. if an update in a table is done at the central server, a line should be inserted at another table, in another database on another machine. is this possible with a triggers, or should i use transactional replication?

thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-03-29 : 09:01:34
It can be done with a TRIGGER and LINKED SERVER. However it is not recommendable.
I think transactional replication is a better and safer approach.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-03-29 : 09:02:02
It's possible as far as you add another server as linked server and use four-part naming syntax to access it inside the trigger.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

Pherkad
Starting Member

23 Posts

Posted - 2007-03-29 : 09:11:17
quote:
Originally posted by Peso
I think transactional replication is a better and safer approach.


yes, but what if my two tables are totally different?
I mean, I always thought replication was used to keep the data identical between two (structurally) identical tables.

can i use transactional replication if
- only a few columns should be inserted in the target table
- some data has to be transformed
- one column in the target table has to contain a textual value, which means that i have to join the ID of a column in my source table with another table.

is this all possible with replication?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-03-29 : 09:15:26
Well, this is new information to us (we do not keep crystal balls here. yet.).
Keep the TRIGGER, add a LINKED SERVER and keep your fingers crossed.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Pherkad
Starting Member

23 Posts

Posted - 2007-03-29 : 09:19:36
quote:
Originally posted by Peso
keep your fingers crossed.


we don't want to keep fingers crossed.
we want to have the best solution.

we're new with replication. time pressure is high and our knowledge is low on replication. i hoped to find here more experienced people for replication, so is the above things also possible with replication (or are triggers the only way out)?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-03-29 : 09:22:28
You may want to stick around until the clever people in the USA wakes up and have the oppurtunity to guide you.
It is 3:23 pm here in Sweden right now, and only 9:23 am in New York, and 6:23 am in Los Angeles.

Wait a few hours and read what they have to say.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Pherkad
Starting Member

23 Posts

Posted - 2007-04-03 : 11:02:09
where are the clever guys from USA?
Go to Top of Page
   

- Advertisement -