trigger has an error

Results 1 to 2 of 2

Thread: trigger has an error

  1. #1
    Join Date
    Dec 1969

    Default trigger has an error

    I have written the following trigger but gives me error at the line where I am trying to assign value to the message variable:<BR><BR>CREATE TRIGGER [NewReservation1] ON [dbo].[RESERVATION] <BR>FOR INSERT<BR>AS<BR>DECLARE @MeetingRoom int,<BR>@Date datetime,<BR>@FromTime numeric,<BR>@ToTime numeric,<BR>@User varchar(50),<BR>@Message varchar(200)<BR>select @MeetingRoom=MeetingRoomId, @Date=ReservationDate, @FromTime=FromTime, @ToTime=ToTime,@User=CreateUser from Reservation where IsNew=&#039;Y&#039;<BR>@Message = &#039;Meeting room &#039; + @MeetingRoom + &#039;is reserved by &#039; + @User + &#039;on &#039; + @Date (this line gives error)<BR>Exec MailReservation<BR>Does anyone know why? Please help

  2. #2
    Join Date
    Dec 1969

    Default Use set or select for assignment

    select @Message = &#039;Meeting room &#039; + @MeetingRoom + &#039;is reserved by &#039; + @User + &#039;on &#039; + cast(@Date as varchar(20))<BR><BR>Shouldn&#039;t you use the @message variable as a parameter to the MailReservation procedure?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts