Reputation: 239
(SELECT t.seccolumnname 'td'
FROM DbName.TableName t
WHERE t.firstcolumname = 1
ORDER BY t.seccolumnname)
FOR XML PATH('tr'), ROOT ('table')
It gives me an error : Incorrect syntax near the keyword 'order'.
Any ideas and suggestions
Upvotes: 2
Views: 9761
Reputation: 1
I can say that ORDER BY clause is invalid in derived tables, as you write in the script above.
Upvotes: 0
Reputation: 452988
Not sure why you have it in brackets? Try
SELECT t.seccolumnname 'td'
FROM DbName.TableName t
WHERE t.firstcolumnname = 1
ORDER BY t.seccolumnname
FOR XML PATH('tr'), ROOT ('table')
Upvotes: 4