timscronin
MIS
The trigger below works. I was wondering for performance reasons is there a better way to try this. The idea is that it will fire if anyone other than the system(dbo) updates it to trap the time and id.
CREATE trigger tr_cmsUpdt_tbnew on ppdnew for update as
-- updates record with sql user and timestamp
DECLARE @muser varchar(35),
@rec_lock_status int,
@ptacpt_status int
set @muser = current_user
begin
if @muser <> 'dbo'
begin
UPDATE ppdnew
set puser_id = @muser, record_timestamp = getdate()
from deleted dt WHERE
ppdnew.ppd_rec_id = dt.ppd_rec_id
end
end
CREATE trigger tr_cmsUpdt_tbnew on ppdnew for update as
-- updates record with sql user and timestamp
DECLARE @muser varchar(35),
@rec_lock_status int,
@ptacpt_status int
set @muser = current_user
begin
if @muser <> 'dbo'
begin
UPDATE ppdnew
set puser_id = @muser, record_timestamp = getdate()
from deleted dt WHERE
ppdnew.ppd_rec_id = dt.ppd_rec_id
end
end