I created a trigger that will add user info to an IMail table.  It works for 1 company (abc), but it doesn't work for the second company (def).
 
CREATE TRIGGER Trigger_Imail ON [Customers]
FOR INSERT as
 
DECLARE @UID varchar(31)
DECLARE @pos int
 
select @uid = email from inserted
 
set @pos = charindex(@uid,'@')
set @uid = substring(@uid,1,@pos)
 
Insert INTO IMAIL
(userid,password,Fullname,UserDir,MAILADDR,MaxSize,MaxMSGs,Flags,[Type])
  Select customerid,cleartextpassword, Firstname + ' ' + LastName
,'d:\IMail-Boxes\Kalnet\users\' + customerid,email,'0','0','128','0'
  FROM Inserted
where DealerID = 'abc'
 
Insert INTO IMail_def
(userid,password,Fullname,UserDir,MAILADDR,MaxSize,MaxMSGs,Flags,[Type])
  Select @uid,cleartextpassword, Firstname + ' ' + LastName
,'d:\IMail-Boxes\mail_acsurf_net\users\' + @uid ,email,'0','0','128','0'
  FROM Inserted
where DealerID = 'def'
 
 
 
I know that the problem lies in using the @uid, but I do not know of any way to do this.  The problem is that I have to manipulate some data before I insert the record into the IMail_def table. 
 
Any help you guys can give will be appreciated.
 
David

Reply via email to