Please help me change the request so that the columns with the amount are right-aligned? They are tagged AS 'money'. I will be using dynamic SQL, so the fields will change. It is important for me that whatever field is not marked with the money tag, is shifted to the right and everything else is centered. I am using this script. Below is the result that I expect.
insert into #a
Values (1, 'GB', 2000),
(2, 'DE', 170),
(3, 'PT', 960)
DECLARE @Values NVARCHAR(MAX)
select @Values = CAST((SELECT ROW_NUMBER() OVER(ORDER BY UserID) AS 'td','',
(SELECT CONCAT('https://backend.com/User/UserDetails.aspx?UserID=',UserId) AS [@href],UserID FOR XML PATH('a'),TYPE) AS 'td',''
,Country AS 'td',''
,TotalDeposits AS 'money',''
FROM #a
FOR XML PATH('tr'),ELEMENTS ) AS NVARCHAR(MAX))
select '<html><body><table border=1 cellpadding=10 style="border-collapse:collapse;">' + + @Values + '</table></body></html>'
<html>
<body>
<table border=1 cellpadding=10 style="border-collapse:collapse;">
<tr align="center" valign="center">
<td>1</td>
<td>
<a href="https://backend.com/User/UserDetails.aspx?UserID=1">
<UserID>1</UserID>
</a>
</td>
<td>GB</td>
<td style="text-align:right;vertical-align:middle;">2000</td>
</tr>
<tr align="center" valign="center">
<td>2</td>
<td>
<a href="https://backend.com/User/UserDetails.aspx?UserID=2">
<UserID>2</UserID>
</a>
</td>
<td>DE</td>
<td style="text-align:right;vertical-align:middle;">170</td>
</tr>
<tr align="center" valign="center">
<td>3</td>
<td>
<a href="https://backend.com/User/UserDetails.aspx?UserID=3">
<UserID>3</UserID>
</a>
</td>
<td>PT</td>
<td style="text-align:right;vertical-align:middle;">960</td>
</tr>
</table>
</body>
</html>