You are here: How do you conditionally fire a trigger (mimic replication) « MsSQL Server « IT news, forums, messages
How do you conditionally fire a trigger (mimic replication)

Posted by steven on 10/19/06 17:02

Does anyone know how to do the following. I'm trying to mimic
replication with triggers.

I have 2 databases, each have these 2 tables.

1.
USERS
ID int
NAME varchar(20)

2.
CHANGES
TABLE varchar(20)
TYPE varchar(10)
col1 varchar(20)
col2 varchar(20)

On the USERS table I have a for insert trigger. Whenever a new user is
added the trigger puts an entry into the CHANGES table such as
("USERS", "INSERT", "1", "Fred")

I now have an application (vb.net) that monitors the CHANGES table on
server1. If it finds an entry it determines the table using the TABLE
column and performs the necessary insert and deletes the entry from
CHANGES. Now the problem is server2 also has an for insert trigger on
the USERS table so it puts an entry into CHANGES on server2. As you
can imagine this goes around in a loop.

What I was hoping for was someway of saying, "I'm inserting from my
application so don't do the trigger".

Any ideas gratefully appreciated.

Steve.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация