Re: [Emerald] SQL Database Transfers

Dale E. Reed Jr. ( (no email) )
Tue, 17 Nov 1998 15:24:17 -0800

Glen Harvy wrote:
>
> At 23:11 16/11/98 -0800, you wrote:
> >Most likely the new trigger did not get installed. Check your calls
> >table to see if you have an insert trigger named calls_insert on it.
>
> Not apparent to me. I guess it will appear in the column name field?
>
> >When you run the create trigger portion of the script, what happens?
>
> Msg 207, Level 16, State 1
> Invalid column name 'ConnectInfo'.
> Msg 207, Level 16, State 2
> Invalid column name 'ConnectInfo'.
> Msg 207, Level 16, State 2
> Invalid column name 'CallerID'.
> Msg 207, Level 16, State 2
> Invalid column name 'CallerID'.

Ok. Thats the reason. The new trigger expects to find ConnectInfo and
CallerID fields in your Calls table and ServerPorts table. If you don't
have those fields, remove the two lines:

CREATE TRIGGER calls_insert ON dbo.Calls
FOR INSERT
AS

DECLARE @ast int

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
(sp.CallDate <= DateAdd(Second, 0-i.AcctDelayTime, i.CallDate) OR
sp.CallDate IS NULL)

Select @ast=i.AcctStatusType From inserted i
IF @ast = 2
BEGIN
Insert INTO CallDetails
Select DateAdd(Second, 0-i.AcctDelayTime, i.CallDate), i.UserName,
i.AcctSessionTime,
i.FramedAddress, i.NASIdentifier, i.CallerID
Where sa.Login = i.username or sa.shell = i.username or sa.Email =
i.username),
From inserted i
Where i.UserName is not NULL and i.UserName <> 'NULL'
END


UPDATE Emerald..SubAccounts
Set sa.TimeLeft = sa.TimeLeft - (i.AcctSessionTime/60 +
1)
FROM Emerald..SubAccounts sa, inserted i
WHERE sa.login = i.UserName
and sa.TimeLeft <> NULL
and i.AcctStatusType = 2
GO

-- Dale E. Reed Jr.  (daler@iea-software.com)_________________________________________________________________       IEA Software, Inc.      |  RadiusNT, Emerald, and NT FAQs Internet Solutions for Today  |   http://www.iea-software.com