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)
 Call a sproc from another server

Author  Topic 

Ken Blum
Constraint Violating Yak Guru

383 Posts

Posted - 2005-05-04 : 08:39:09
Can a database insert trigger call a sproc on another server? Do the servers have to be "linked" to do this or can my Server1.Database insert trigger just do this...


EXEC Server2.TestDataBase.fj_create_monitor @serial,@error_code,@comment,@timestamp


Here's the sproc on "Server2.TestDataBase"


CREATE PROCEDURE fj_create_monitor
@serial_no varchar(30), /* Serial Number */
@error_code varchar(8), /* Error Code */
@comment varchar(254), /* Comment */
@created_at datetime, /* timestamp */
@l_return integer output
as


INSERT INTO fj_monitor
( comment,
created_at,
error_code,
serial_no )
VALUES ( @comment,
@created_at,
@error_code,
@serial_no)
IF @@error <> 0
BEGIN
select -1
return
END

Commit
select 0
return


TIA,

Ken Blum
Constraint Violating Yak Guru

383 Posts

Posted - 2005-05-04 : 13:12:26
OK, this will work by linking the servers, which is my answer
Go to Top of Page
   

- Advertisement -