The "@uid" in your final select statement should be selected with an "AS":
@UID AS USERID

Insert INTO IMail_def
(userid,password,Fullname,UserDir,MAILADDR,MaxSize,MaxMSGs,Flags,[Type])
  Select @UID AS USERID,cleartextpassword, Firstname + ' ' + LastName
,'d:\IMail-Boxes\mail_acsurf_net\users\' + @uid ,email,'0','0','128','0'
  FROM Inserted
where DealerID = 'def'

Chris
----------------------------------------------
Original Message
From: "David Hayes-Moats"<[EMAIL PROTECTED]>
Subject: [IMail Forum] OT: Any sql experts that can help?
Date: Tue, 12 Feb 2002 20:26:29 -0500




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,[T ype])
  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,[Typ e])
  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
Please visit http://www.ipswitch.com/support/mailing-lists.html to be removed from this list. An Archive of this list is available at: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/

Reply via email to