Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kirkeby
Yak Posting Veteran
57 Posts |
Posted - 2001-06-05 : 16:41:02
|
| I tried your suggestion in the topic entitled "Email when data inserted into table" but it's not working for me. Here's my trigger:CREATE TRIGGER ConfirmItON ReqCommon FOR INSERTASDECLARE @RequesterName varchar(60),@RequesterEmail varchar(60),@RequestID int, @Time datetime,@msg varchar(100);IF EXISTS (SELECT Request_ID FROM ReqCommon WHERE Current_Status_ID = 7)BEGINSET @RequesterName = (SELECT Requester_Name FROM ReqCommon)SET @RequesterEmail = (SELECT Requester_Email FROM ReqCommon)SET @RequestID = (SELECT Request_ID FROM ReqCommon)SET @Time = (SELECT Request_Date FROM ReqCommon)SET @msg = @RequesterName + @RequestID + cast(@Time as varchar(32))exec master.dbo.xp_sendmail @Recipients = @RequesterEmail, @subject = 'Your request has been received', @message = @msg, @dbuse='Staging'endIn Query Analyzer, here's the error I receive:Server: Msg 512, Level 16, State 1, Line 0Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.I get this error also for lines 10, 11 and 12, and of course, an error telling me the mail session was not started.I'm stumped. Also, how do you enable and disable triggers? Thanks!!! |
|
|
|
|
|
|
|