Tuesday, March 27, 2012
Distinguish changes by replication and changes by user
Merge Replication, SQL Server 2005
I have got a table with an update trigger that is supposed to fire when a
user updates a field.
When replicating this database, the trigger fires when a user updates a
field *and* when the update is performed by the replication process.
How can I avoid the latter? Is there a TSQL-function to distinguish the two?
Thanks for your effort, Wolfgang
Another way is to hack into the sessionproperty
ie if ('replication_agent') <> 1 then its a user action.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Wolfgang" <Wolfgang@.discussions.microsoft.com> wrote in message
news:168538E7-89A2-45F3-ABD6-566F2C4B3760@.microsoft.com...
> Hello,
> Merge Replication, SQL Server 2005
> I have got a table with an update trigger that is supposed to fire when a
> user updates a field.
> When replicating this database, the trigger fires when a user updates a
> field *and* when the update is performed by the replication process.
> How can I avoid the latter? Is there a TSQL-function to distinguish the
> two?
> Thanks for your effort, Wolfgang
sql
Wednesday, March 21, 2012
distibuted transations in linked server
please solve this problem.
when i am executing any transaction from one server to update record in other linked server database.
create PROCEDURE [dbo].[aTest]
@.iNum as int
AS
BEGIN
SET NOCOUNT ON;
begin tran
update aaa set sName='Deepak'
where iNum=@.iNum
exec [REPORTSRVR\SQL2005].HDFCCUSTOMER.dbo.aProc @.iNum
if @.@.error <> 0
begin
rollback tran
return
end
else
begin
commit tran
end
SET NOCOUNT OFF;
END
it shows following error
The operation could not be performed because OLE DB provider "SQLNCLI" for linked server "REPORTSRVR\SQL2005" was unable to begin a distributed transaction.
1. Check/change your server option "remote proc trans" via sp_configure or Connections tab in SQL Server Instance Properties window
2. If you need MS DTC for distributed transactions: http://blogs.msdn.com/mab/archive/2005/12/30/508273.aspx
|||thanks for response.
i m using transaction statement. is it possible that single transaction can talk from two server?