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 : 04:58:11
|
| 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 INSERTAS BEGIN SET 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 name select @journal_code = JRN_CODE from inserted select @journal_no = JRN_NO from inserted insert into log_insert_Jour values (@date1,@person,@Journal_code,@journal_no)ENDThanksThanks |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2007-11-29 : 05:03:51
|
| You will need to have a field or table on the subscriber to hold this and then pass that back to the distributer. |
 |
|
|
|
|
|