Advertisement

08.15.2007 at 09:18AM PDT, ID: 22764627
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.8

Using a view within a trigger

Asked by wrcplc in MS SQL Server

Tags:

I am trying to develop a trigger that will pick up a contract manager email address and email to him saying the contract has been opened.  The view in question has a field called "email" which ids the address I want.

when I run the code I get "Invalid object name 'vw.EmailLink'." and cant see why.

I am a novice in SQL so would appreciate what help I can get.  Aslo, if anyone knows of a good triggers help resource on the web (other than yourselves) please let me know

Thanks

/////////////////////////////////////////////////////////////////////////////
CREATE TRIGGER [startup] ON [dbo].[PROJECT]
FOR INSERT, UPDATE, DELETE
AS


declare @mymsg varchar(2000)
declare @mytitle varchar (200)
declare @myemail varchar (50)

IF (SELECT Count(*) FROM inserted) > 1
      RAISERROR('Can''t insert more than 1 contract', 16, 1)

set @mytitle = 'Contract ' + (SELECT proj_code FROM inserted) +' now raised'
set @mymsg =   ' Please do not reply to this messsage as it is autogenerated. New contract: ' + (SELECT proj_code FROM inserted) + '  has been raised.  It will be live on SharpOwl tomorrow '
set @myemail=(select email from vw.EmailLink where dbo.EmailLink.staffno = dbo.inserted.proj_anal_code_7)

exec master..xp_sendmail @recipients = @myemail ,
@subject = @mytitle ,
@message = @mymsg
////////////////////////////////////////////////////////////////////////////////////////////////////////////Start Free Trial
 
Loading Advertisement...
 
[+][-]08.15.2007 at 09:20AM PDT, ID: 19701092

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]08.15.2007 at 09:28AM PDT, ID: 19701181

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]08.15.2007 at 02:45PM PDT, ID: 19703753

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS SQL Server
Tags: SQL
Sign Up Now!
Solution Provided By: ScottPletcher
Participating Experts: 2
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628