June 13, 2007 at 2:35 pm
Hi,
My Space_Alert stored proc is not able to invoke sp_notify_operator system proc dynamically as follows:
@Message variable gets populated if server drives fall below 5GB.
******************
DECLARE @CMD varchar(2000), @retstats int, @Message varchar(1000)
set @CMD = 'msdb.dbo.sp_notify_operator @profile_name = ''SQLAgentMail'' , ' +
'@name = ''Sameer Gujar'' , @subject = ''Space Alert of VSCHISQL20051 '', ' +
'@body = ''' + @Message + ''
EXECUTE @retstats = @CMD
****************
Error I receive states:
The name 'msdb.dbo.sp_notify_operator @profile_name = 'SQLAgentMail' , @name = 'Operator1' , @subject = 'Space Alert ',
@body = '
C:\ ------------- 4GB
D:\ ------------- 4.5GB
E:\ ------------- 2GB
F:\ ------------- 3GB' is not a valid identifier.
*********
The above statement within the error message works fine if i run it from a Query window. EXECUTE statement is as per book online example, but it fails..
Appreciate any help ...
June 14, 2007 at 9:47 pm
EXEC (@CMD)
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply