Blog Layout

Data Monitor XML & HTML Email

E.DIN Editor • Oct 01, 2020

 ***** My Valid Data Monitor **** XML OUT *** HTML EMAIL DELIVERY  *****

IF OBJECT_ID('tempdb..#tCustomerID') IS NOT NULL DROP TABLE #tCustomerID

    select distinct 

        mm.CustomerID 

Into #tCustomerID

    from myDatabase..myTable (nolock) mm 

    left join myDatabase.dbo.myOtherTable (nolock) mo 

on mm.refID = mo.id 

    left join myDatabase.dbo.myOtherTableDetail (nolock) mod 

on mo.id = mod.myOtherTableid 

        and mm.SearchValue = mod.SearchValue 

    where mm.refID is not null 

    and mm.quantity is not null  

    and mod.SearchValue is null


IF Exists (Select 1 From #tCustomerID)

BEGIN 

DECLARE @xml NVARCHAR(MAX)

DECLARE @body NVARCHAR(MAX)

SET @xml = CAST(( SELECT [CustomerID] AS 'td' FROM #tCustomerID ORDER BY CustomerID

FOR XML PATH('tr'), ELEMENTS ) AS NVARCHAR(MAX))

SET @body ='<html><body><H3>My Valid Data Monitor</H3>

<table border = 1><tr> <th> CustomerID </th> </tr>'    

SET @body = @body + @xml +'</table></body></html>'

--SELECT @body

  exec msdb.dbo.sp_send_dbmail 

@profile_name  = 'dbmailProfile'

,@recipients    = 'usergroup@mydomain.com'

,@subject       = 'My Valid Data Monitor'

,@body          = @body

,@body_format   = 'HTML'

END

By E.DIN Editor 17 Nov, 2021
Title: Base64 Encoding With Simple Salt (and decoding)
By E.DIN Editor 17 Nov, 2021
XPCMD_SHELL Move & Load Data from Directory
By E.DIN Editor 17 Nov, 2021
By E.DIN Editor 17 Nov, 2021
By websitebuilder 20 Sep, 2020
The new season is a great reason to make and keep resolutions. Whether it’s eating right or cleaning out the garage, here are some tips for making and keeping resolutions.
By websitebuilder 20 Sep, 2020
There are so many good reasons to communicate with site visitors. Tell them about sales and new products or update them with tips and information.
By websitebuilder 20 Sep, 2020
Write about something you know. If you don’t know much about a specific topic that will interest your readers, invite an expert to write about it.
By tekp 15 Jul, 2020
Turn Up! Not every microphone has the same base volume for transmitting your voice through your computer to whoever or whatever is on the other end of the exchange. Some microphones have a higher volume as compared to others, and some microphones have a volume that is so low that the person on the other […] The post How to Turn Up Mic Volume in Windows 10 – Appuals.com appeared first on TekPreacher.
By E.DIN Editor 09 Jun, 2020
'+@UNCPathAndLogTable+'
By E.DIN Editor 14 May, 2020
--UNIQUE AND RANDOM TRANSACTION NAMES (FOR HIGH VOLUME TRANSACTIONS PER SECOND)DECLARE @randomString VARCHAR(255) = CONVERT(varchar(255), NEWID());SELECT @randomString = replace(replace(replace(convert(varchar, getdate(), 120),':',''),'-',''),' ','') + RIGHT(@randomString,10);PRINT ''+ CONVERT(VARCHAR,LEN(@randomString)) + ' CHARS / OF MAXIMUM 32 CHARS FOR LENGTH OF TRANSACTION NAMES'SELECT @randomStringBEGIN TRANSACTION  @randomStringSELECT replace(replace(replace(convert(varchar, getdate(), 120),':',''),'-',''),' ','');SELECT CONVERT(VARCHAR,getdate(),112) + LEFT(REPLACE(CONVERT(VARCHAR,getdate(),114),':',''),6);SELECT REPLACE(SUBSTRING(CONVERT(VARCHAR(33),SYSDATETIMEOFFSET(),126), 1, 8), '-', '') + SUBSTRING(REPLACE(REPLACE(REPLACE(CONVERT(VARCHAR(33), SYSDATETIMEOFFSET(), 126),'T',''),'.',''),':',''),9,DATALENGTH(CONVERT(VARCHAR(33), SYSDATETIMEOFFSET(), 126)))COMMIT TRANSACTION  @randomStringOUTPUT-- 24 CHARS / OF MAXIMUM 32 CHARS FOR LENGTH OF TRANSACTION NAMES-- 202005141039592610925CAA  <- THIS IS THE ONE-- 20200514103959-- 20200514103959-- 202005141039598866412-0500
More Posts
Share by: