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 |
|
gjkiker
Starting Member
1 Post |
Posted - 2009-08-06 : 12:15:35
|
| Please help. It is not grabbing the most recent update, but does grab the last record in the DB. not sure what I am doign wrong.thanksUSE [Waivers]GOSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER TRIGGER [dbo].[EMAIL_VP_updated]ON [dbo].[Media_request]FOR UPDATEASIF (SELECT COUNT(*) FROM inserted) = 1 BEGINdeclare @CommentID varchar(10)declare @msg varchar(3000) DECLARE @FN nvarchar(200)DECLARE @LN nvarchar(200)DECLARE @WAV nvarchar(200)DECLARE @WAVTITLE nvarchar(200)DECLARE @WAVVP nvarchar(200)DECLARE @WAVVPEMAIL nvarchar(200)DECLARE @STATUS_ nvarchar(200) SELECT @CommentID = Media_rec_no, @FN = media_first_name, @LN = media_last_name, @WAV = Media_justification, @WAVVP = media_vp_fname, @WAVVPEMAIL = media_vp_email, @STATUS_ = media_approved FROM Media_request SET @msg = 'Dear ' + @WAVVP + ', You have ' + @STATUS_ + 'ed the requested exception for the removable media lockdown for ' + @FN + ' ' + @LN + ' Thank you, Information Security Governance Department Information Risk Management Team' --xp_sendmail is the extended sproc used to send the mail EXEC msdb.dbo.sp_send_dbmail @profile_name = 'Waivers', @recipients = 'gjkiker@cvty.com', @subject = 'Waiver Request', @body = @msgGreg |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2009-08-06 : 12:23:47
|
| shouldn't you be selecting from the inserted pseudotable and not from the whole table?___________________________________________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.5 out! |
 |
|
|
|
|
|
|
|