tnguyen315
MIS
This is the stored procedure:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_ResendPayEmail]
(
@id int
)
AS
DECLARE @operatorname AS nvarchar(100),
@operatoremail AS nvarchar(100),
@title AS nvarchar(100),
@message AS nvarchar(max),
@webpermitid AS int
--CHECK IF Database Mail Configured
IF EXISTS (SELECT * FROM sys.configurations WHERE name = 'Database Mail XPs' AND value_in_use = 1)
BEGIN
SELECT @id = Operational_ID, @operatorname = Operator_Name, @operatoremail = Operator_Email FROM TableA
WHERE Operational_ID = @id
IF @operatoremail IS NOT NULL
BEGIN
SELECT @webpermitid = WebPermitID FROM tblWebPermit WHERE PrelimApproval is null AND ApprovalID = @id AND PermitType = 'T'
--CHECK IF corresponding record is in WebPermits
IF @webpermitid IS NOT NULL
BEGIN
--SET Subject
SET @title = 'Permit'
--SET Body
SET @message = '<img alt="" src=" + ''
SET @message += @operatorname + ',<br /><br /> approved</b>.<br />'+
'Your Operator ID number is ' + CAST(@id AS nvarchar(max)) + '.<br /><br />'
SET @message += ' + CAST(@id AS nvarchar(max))
SET @message += '<br /><br />If you have any questions, please call us at 800-800-8888 or email us at test@abc.com.<br /><br />' +
'Thank You,<br /><br />'
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Test Email',
@body_format = HTML,
@recipients = 'ts@abc.com',
@body = @message,
@subject = @title
END
END
END
On my form i have a button named "cmdResendEmail"
Thanks
TWEE
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_ResendPayEmail]
(
@id int
)
AS
DECLARE @operatorname AS nvarchar(100),
@operatoremail AS nvarchar(100),
@title AS nvarchar(100),
@message AS nvarchar(max),
@webpermitid AS int
--CHECK IF Database Mail Configured
IF EXISTS (SELECT * FROM sys.configurations WHERE name = 'Database Mail XPs' AND value_in_use = 1)
BEGIN
SELECT @id = Operational_ID, @operatorname = Operator_Name, @operatoremail = Operator_Email FROM TableA
WHERE Operational_ID = @id
IF @operatoremail IS NOT NULL
BEGIN
SELECT @webpermitid = WebPermitID FROM tblWebPermit WHERE PrelimApproval is null AND ApprovalID = @id AND PermitType = 'T'
--CHECK IF corresponding record is in WebPermits
IF @webpermitid IS NOT NULL
BEGIN
--SET Subject
SET @title = 'Permit'
--SET Body
SET @message = '<img alt="" src=" + ''
SET @message += @operatorname + ',<br /><br /> approved</b>.<br />'+
'Your Operator ID number is ' + CAST(@id AS nvarchar(max)) + '.<br /><br />'
SET @message += ' + CAST(@id AS nvarchar(max))
SET @message += '<br /><br />If you have any questions, please call us at 800-800-8888 or email us at test@abc.com.<br /><br />' +
'Thank You,<br /><br />'
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Test Email',
@body_format = HTML,
@recipients = 'ts@abc.com',
@body = @message,
@subject = @title
END
END
END
On my form i have a button named "cmdResendEmail"
Thanks
TWEE