In ISQL_W or SEM run the following query:
CREATE TRIGGER calls_insert ON dbo.Calls
FOR INSERT
AS
UPDATE ServerPorts
Set sp.UserName = i.UserName,
sp.AcctStatusType = i.AcctStatusType,
sp.CallDate = DateAdd(Second, 0-i.AcctDelayTime, i.CallDate),
sp.FramedAddress = i.FramedAddress
FROM Servers s, ServerPorts sp, inserted i
WHERE s.IPAddress = i.NASIdentifier AND
s.ServerID = sp.ServerID AND
sp.Port = i.NASPort AND
(DateAdd(Second, 0-i.AcctDelayTime, i.CallDate) > sp.CallDate OR
sp.CallDate IS NULL)
UPDATE SubAccounts
Set sa.TimeLeft = sa.TimeLeft - (i.AcctSessionTime/60 + 1)
FROM SubAccounts sa, inserted i
WHERE sa.login = i.UserName
and sa.TimeLeft <> NULL
and i.AcctStatusType = 2
GO
Robert Boyle Server Co-location,
Garden Networks Internet Access,
50 Diller Ave Development & Consulting
Newton, NJ 07860 (973)300-9211 Ext.103
8AM-8PM Mon-Fri EST http://www.garden.net
Lucent RABU & Software.Com Post.Office VAR