0
sp-send-dbmail을 사용할 때 쿼리 후에 본문 텍스트를 추가해야합니다. 현재 메일을 보내는 내 저장 절차는 다음과 같습니다.sp-send-dbmail을 사용한 쿼리 후 텍스트
ALTER PROCEDURE [dbo].[sp_SendSFRProcesingEmail]
-- Add the parameters for the stored procedure here
(@cmp_code nvarchar(5), @email nvarchar(50), @rbc_email nvarchar(50))
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
DECLARE @profile nvarchar(50)
DECLARE @subject nvarchar(100)
DECLARE @querystr nvarchar (MAX)
set @profile = 'Reports'
set @subject = 'Company Service Fee Processing for ' + @cmp_code
set @querystr = 'SET NOCOUNT ON
SELECT [Year], [Week], [Description], [Cash_In**], [Cash_Out**], [Amt.Due]
FROM [001].[dbo].[SFR_Processing_LatestBatch]
WHERE [cmp_code] = '''[email protected]_code+'''';
EXEC msdb.dbo.sp_send_dbmail
@profile_name = @profile,
@recipients = '[email protected]',
@subject = @subject,
@body = 'Note: This is an automatic e-mail message generated by Company.
The Service Fee Information below was imported via an automated process from RGS. Please compare the information below to your records for the week listed and report any discrepancies immediately.
If you have any questions or concerns regarding this email please contact your Regional Business Consultant.
Thank you!
Company, Inc.
Accounting Department
[email protected]
**Amount(s) should equal Item 1 per weekly Service Fee Report for Account Number indicated in Subject Line.
',
@query = @querystr
END
내 예를 들어, 그림에서와 같이 오히려 이메일의 맨 끝에서보다 어딘가에 몸의 중앙에 쿼리 결과를 이동하는 방법이 있나요?
'HTML 표'언어를 사용하여 몸체를 시험해보고 필요하면 'CSS' – LONG