Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

loginname or username

2 posts in Windows NT Last posting was on 2000-12-27 21:45:03.0Z
Nie Maosheng Posted on 2000-12-22 07:15:34.0Z
From: "Nie Maosheng" <jimmy_nie@163.net>
Subject: loginname or username
Date: Fri, 22 Dec 2000 15:15:34 +0800
Lines: 12
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Message-ID: <5ycFjj#aAHA.47@forums.sybase.com>
Newsgroups: sybase.public.sqlserver.nt
NNTP-Posting-Host: 61.154.236.111
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:1373
Article PK: 1088839

Hi,

Customer request to record who and when modify the data, and I want to write
a trigger on the table for update and delete, But how to know who issue the
command?

Thanks in advance!

Jimmy Nie
2000-12-22


JA Posted on 2000-12-27 21:45:03.0Z
From: "JA" <javila@tutopia.com>
References: <5ycFjj#aAHA.47@forums.sybase.com>
Subject: Re: loginname or username
Date: Wed, 27 Dec 2000 16:45:03 -0500
Lines: 45
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Message-ID: <kIQIxAFcAHA.288@forums.sybase.com>
Newsgroups: sybase.public.sqlserver.nt
NNTP-Posting-Host: 200.14.231.130
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.sqlserver.nt:1364
Article PK: 1088829

You could try something like:

create table rec_table(
rec_login varchar(30) not null,
rec_date datetime)
go

create trigger <trigger_name>
on <table_name>
for update, delete
as
insert into rec_table
values( suser_name(), getdate() )
go

The system function 'suser_name()' returns the login name of the current
user.

Each time the user updates or deletes data from <table_name> his/her login
name is recorded on table rec_table.

You could also try configuring ASE's audit database and audit all insert and
update operations on <table_name>.

Hop this helps,

JC

"Nie Maosheng" <jimmy_nie@163.net> wrote in message
news:5ycFjj#aAHA.47@forums.sybase.com...
> Hi,
>
> Customer request to record who and when modify the data, and I want to
write
> a trigger on the table for updatend delete, But how to know who issue the
> command?
>
> Thanks in advance!
>
> Jimmy Nie
> 2000-12-22
>
>