You would not ever want to disable a trigger if you lost connectivity, you wopuld want the actions to rollbnack or else you would have data integrity problems inthe furture where refords inthe other db were not inserted or updated when they should have been. You want to use @@error and rollback if there are any errors.
thanks for the responses. I am using the set --SET xact_abort ON and when the middle server goes down it affects the main servers speed of inserts on the table with the trigger. i am not sure why it slows down but I want to disable the trigger if the linked server goes down. data integrity is not an issue in this case.
i can't see to get the sql statement to run.
if @@error <> 0
begin
print 'everything is ok'
end
else
begin
begin distributed transaction
SELECT count(*) FROM linked servername.dbname.dbo.tblTable
commit tran
alter table diable trigger code
end
i understand but my code does not work with the begin distributed transaction...i think it has to do with the linked server or something. can you show me how to structure it?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.