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)
 Need Help Trigger Before/After Insert

Author  Topic 

chapo
Starting Member

39 Posts

Posted - 2008-06-10 : 23:42:26
I'm new to triggers but basically what I want to do is the following, I have 2 databases name Prod and Dev In the Prod database I have a table call Sales I’m only interested in the Sale_ID field. On the Dev database I have a table call QMD and once more I’m only interested in the Sale_ID field. What I would like to do is as soon as a new record gets created in the Sales table located in the Prod database I would like to grab the Sale_ID and create a new record on the QMD table of the Dev database with the same Sale_ID, and leaving the other field blank of the newly created record.

Thank You

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-11 : 00:06:32
I dont think writing a cross db trigger will be a good idea. It will be better if you do this cross db data transfer in batches may be use some bulk transfer methods rather than inserting record by record to another db while each one is created.
Go to Top of Page

chapo
Starting Member

39 Posts

Posted - 2008-06-11 : 16:57:14
quote:
Originally posted by visakh16

I dont think writing a cross db trigger will be a good idea. It will be better if you do this cross db data transfer in batches may be use some bulk transfer methods rather than inserting record by record to another db while each one is created.



I need this to happend live since as soon as the new record is created in the DEV database I will have another application pointing to the table therefore we can fill some of the other fields.

The reasond I need this to happend is because we can't touch the PRO database at all or we will void our warranty. So therefore we created a new table on another database where we can do anything we desire but I need a way of linking the data between the two tables.
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2008-06-11 : 17:25:39
quote:
Originally posted by chapo

quote:
Originally posted by visakh16

I dont think writing a cross db trigger will be a good idea. It will be better if you do this cross db data transfer in batches may be use some bulk transfer methods rather than inserting record by record to another db while each one is created.



I need this to happend live since as soon as the new record is created in the DEV database I will have another application pointing to the table therefore we can fill some of the other fields.

The reasond I need this to happend is because we can't touch the PRO database at all or we will void our warranty. So therefore we created a new table on another database where we can do anything we desire but I need a way of linking the data between the two tables.



If you can't change the Prod database, why are you thinking about creating a trigger in the Prod database? Won't that void your warranty?



CODO ERGO SUM
Go to Top of Page
   

- Advertisement -