By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
SELECT (
SELECT
'myfunction()' AS [th/@onclick],
'SomeClass' AS [th/@class],
th
from (VALUES
('Court 1'),
('Court 2'),
('Court 3'),
('Court 4')
) v(th)
FOR XML PATH(''), ROOT('tr'), TYPE
) AS headertr
headertr |
---|
<tr><th onclick="myfunction()" class="SomeClass">Court 1</th><th onclick="myfunction()" class="SomeClass">Court 2</th><th onclick="myfunction()" class="SomeClass">Court 3</th><th onclick="myfunction()" class="SomeClass">Court 4</th></tr> |