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
 Transact-SQL (2000)
 can anybody help me to solve this issue

Author  Topic 

DURGESH
Posting Yak Master

105 Posts

Posted - 2009-04-06 : 03:05:49
hi all,
I have two databases "DB1" and "DB2"
when i insert a record in table of "DB1" then it should get insert into the table of "DB2". I am doing this using Triggers.
But I am facing a problem when a table of "DB1" is having an Image column then it is giving an error as
"Cannot use text, ntext, or image columns in the 'inserted'"
to overcome from this error i supposed to use "Instead Of" trigger.
I have a doubt that if i use instead of trigger then will that is get inserted in both the tables of Different databases

Regards
Durgesh

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-04-06 : 03:47:44
Better U can use a Stored procedure to insert data in two table(in different DB) one by one..

insert into DB1.table1 values(...)

Insert into DB2.table1 values(...)

Regards

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2009-04-06 : 10:10:17
If you are not writing to DB2 (other than from the trigger) then you replicate the table from DB1 to DB2. Probably transactional replication with a push subscription.

alternatively, just to make the trigger work - you can insert from inserted INNER JOIN DB1.<table> on <PK>=<PK> select the image column from your DB1.<table> instead of the inserted table.

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -