当我以xml格式解析日期行时,根据td设置背景颜色
declare @xml1 xml
SET @xml1 = CAST((select Region AS 'td','',
[MTD Total] AS 'td','',
[MTD] AS 'td','',
[MTD Percentage] AS 'td','',
[FTD Total] AS 'td','',
[FTD] AS 'td','',
[FTD Percentage] AS 'td',''
FROM #temp
FOR XML PATH('tr'), ELEMENTS ) AS NVARCHAR(MAX))
select @xml1
答案 0 :(得分:0)
你应该
class
属性并使用CSS 如果您真的想继续上述内容,可以尝试以下方法:
<td>
与引入一般declare @xml1 xml =
(
select
'blue' AS [td/@bgcolor],
Region AS 'td','',
'red' AS [td/@bgcolor],
[MTD Total] AS 'td','',
'white' AS [td/@bgcolor],
[MTD] AS 'td','',
'green' AS [td/@bgcolor],
[MTD Percentage] AS 'td','',
'yellow' AS [td/@bgcolor],
[FTD Total] AS 'td','',
'black' AS [td/@bgcolor],
[FTD] AS 'td','',
'blue' AS [td/@bgcolor],
[FTD Percentage] AS 'td',''
FROM #temp
FOR XML PATH('tr'),TYPE
);
select @xml1
属性的方式相同......