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 2000 Forums
 SQL Server Administration (2000)
 Triggers Problem

Author  Topic 

zakwithu
Starting Member

8 Posts

Posted - 2009-09-30 : 05:15:28
Hi All,
I'm tring to catch records being inserted in a SQL server 2k by a hardcoded software.
I create a trigger in the first database (say db1) to update a table in another database(db2)
both tables are identical(tblA & tblB).


CREATE TRIGGER [Update_db2_tblB] ON db1.dbo.tblA
FOR INSERT
AS
BEGIN
INSERT INTO db2.dbo.tblB
SELECT * from inserted
END


the problem is that i see the db1.dbo.tblA is being filled but db2.dbo.tblB is not updated.
since the software that fills db1.dbo.tblA is hardcoded (not open source) I'm not sure about the way it use to do insert.

1) I thought triggers not enabled in the database but regardless of wheater it is enabled or disabled I enabled it like this:
ALTER TABLE db1.dbo.tblA ENABLE TRIGGER ALL


2) Also I think that software use bulk insert instead of insert.

Q1:what things that might be the reason?
Q2:how can i control triggers when using bulk insert?
Q3: is there any way to insert records without affecting triggers?

any other howto, guidance idea would be highly appreciated.


thank you all

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-09-30 : 12:46:05
If the software uses bulk insert, then a trigger is not going to work.

Why don't you use transactional replication instead or write a SQL job to do it?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

zakwithu
Starting Member

8 Posts

Posted - 2009-09-30 : 23:51:23
thank you Tara Kizer for the reply...

what's the "transactional replication" ?
can you elaborate? I'm not sure I completely understand it.

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-10-01 : 13:04:32
Check SQL Server Books Online for details about transactional replication.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-10-01 : 15:35:44
http://www.databasejournal.com/features/mssql/article.php/1438201/Setting-Up-Transactional-Replication-A-Step-by-step-Guide.htm
Go to Top of Page
   

- Advertisement -