0

I have a table in sql server like this

Table

I formatted this data in html

SELECT Isnull(dbo.Rtrimwhitespace(Ltrim([read date])), 'NULL')                AS [td], 
       Isnull(dbo.Rtrimwhitespace(Ltrim([collection configuration])), 'NULL') AS [td], 
       Isnull(dbo.Rtrimwhitespace(Ltrim([summary type])), 'NULL')             AS [td], 
       Isnull(dbo.Rtrimwhitespace(Ltrim([total number])), 'NULL')             AS [td], 
       Isnull(dbo.Rtrimwhitespace(Ltrim([# mep count])), 'NULL')              AS [td], 
       Isnull(dbo.Rtrimwhitespace(Ltrim([% mep])), 'NULL')                    AS [td]

FROM   ##collection_window_monitor 
ORDER  BY [read date] ASC, 
          [collection configuration] ASC, 
          [summary type] ASC, 
          [total number] ASC, 
          [# mep count] ASC, 
          [% mep] ASC 
FOR xml raw('tr'), elements 

Now I want to add style for the trs where [summary type] like '%Not Valid%'

How can I do that?

stuartd
  • 70,509
  • 14
  • 132
  • 163
  • 1
    I think you can study one of the answers in `http://stackoverflow.com/questions/7086393/create-html-table-with-sql-for-xml` (in particular the one of Shnugo) – etsa Mar 31 '17 at 15:15
  • In [this answer](http://stackoverflow.com/a/39487565/5089204) I provide a function, which will create an HTML table out of any `SELECT` statement with support for styles and links. – Shnugo Mar 31 '17 at 15:46

0 Answers0