Condition for Not to Send Mail

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #165295

    Hi,

    I am using below condition for sending mail from SQL Server, but i want add the condition for not to send mail “IF (@A1SQL IS NULL )”

    can someone provide the code part for that?

    — Condition for Send Mail

    [HTML]SET @A1SQL = N’select * from Tablename’;

    IF (@A1SQL IS NOT NULL )
    BEGIN

    SET @tableHTML =

    N’

    details

    ‘ +

    N’

    ‘ +
    N’

    ‘ +
    N’

    ‘ +

    CAST ( ( SELECT “td/@align” = ‘right’, td = createdate, ”,
    “td/@align” = ‘right’, td = dbname, ”

    FROM TableName

    FOR XML PATH(‘tr’), TYPE

    ) AS NVARCHAR(MAX) ) +

    N’

    createdate dbname

    ‘ ;

    EXEC MSDB.DBO.SP_SEND_DBMAIL
    @profile_name=’xxxx’,
    @recipients=’xxxxx’,
    @subject =’ details ‘ ,
    @body = @tableHTML,
    @body_format =’HTML’
    end[/HTML]

    thanks.

    [MOD EDIT – hyperlink to commercial (spam) site removed and warning issued. Next time WILL be a ban]
    [MOD EDIT 2 – “Next time” was in the user profile…. bye, bye :evil:]

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

External Sharing and Guest User Access in Microsoft 365 and Teams

This eBook will dive into policy considerations you need to make when creating and managing guest user access to your Teams network, as well as the different layers of guest access and the common challenges that accompany a more complicated Microsoft 365 infrastructure.

You will learn:

  • Who should be allowed to be invited as a guest?
  • What type of guests should be able to access files in SharePoint and OneDrive?
  • How should guests be offboarded?
  • How should you determine who has access to sensitive information in your environment?

Sponsored by: