Table Alerts

  • DECLARE @EN VARCHAR(50)
    DECLARE @PN varchar(60)
    DECLARE @EA varchar(50)
    DECLARE @CE varchar(100)
    DECLARE @DtT datetime
    DECLARE @body varchar(150)
    DECLARE MCursor CURSOR LOCAL FAST_FORWARD READ_ONLY FOR
    SELECT PN,EA,PN+'@'+EA,CONVERT(VARCHAR(10), CAST(DtT AS TIME), 0)from TableName
    OPEN MCursor;
    WHILE 1=1
    BEGIN
    FETCH NEXT FROM MCursor INTO @EN,@PN,@EA,@CE,@DtT;
    IF @@FETCH_STATUS = -1 BREAK;
    SET @body = 'Test '+@EN+' at '+ CONVERT(VARCHAR(10), CAST(@DtT AS TIME), 0)
    EXEC msdb.dbo.sp_send_dbmail
    @recipients = @CE,
    @subject = 'Test Mail',
    @body = @body
    END
    CLOSE
    MCursor;
    DEALLOCATE MCursor;
    RETURN;
    GO

    When CE is PhoneNumber@txt.att.net(Any AT&T number..1234567890@txt.att.net) with DtT column values in this format - 2020-11-22 14:50:00.000.It does not display AM or PM.

    I receive Test A at 2:50.But I need to receive Test A at 2:50 PM

    How do I fix it.

    Any suggestions.

    Thanks

    • This reply was modified 4 years, 1 month ago by  mtz676.

Viewing post 31 (of 30 total)

You must be logged in to reply to this topic. Login to reply