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.
Author |
Topic |
rhiel_x
Starting Member
2 Posts |
Posted - 2007-11-29 : 19:15:39
|
I have problem like this.I have 2 server with merge replicationthe first as distributor and the second as subscriber.I'll try to make trigger from database replication on distributor.the problem is if any change data on subscriber, i need the user name from subscriber.right now, i used user_sname to get user name.but on distributor always get name Administrator.it's because when subscriber update or delete data, distributor always change/delete/add data from subscriber as Administrator.but, we know data change from subscriber it's from user. I need to retrieve user name that who change the data.someone have any solution.This is my triggersset ANSI_NULLS ONset QUOTED_IDENTIFIER ONgoALTER TRIGGER [tr_insert_jour] ON [dbo].[Jour]AFTER INSERTASBEGINSET NOCOUNT ON;declare @date1 datetime, @person varchar(30) , @journal_code char(4), @journal_no char(8)set @date1 = getdate()set @person = user_name() ----this is user nameselect @journal_code = JRN_CODE from insertedselect @journal_no = JRN_NO from insertedinsert into log_insert_Jour values (@date1,@person,@Journal_code,@journal_no)ENDThanksThanks |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-11-29 : 19:33:37
|
You can't do this on the subscriber unless you modify the replication stored procedures (on the publisher) to also pass that information to you.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|