In my database, I intend to get the – [TableName] as the first column and all columns of that table in a “, ” (comma followed by space – delimiter) as the second column – for all tables in the DB.
Table A | ColumnA1, ColumnA2, ColumnA3
Table B | ColumnB1, ColumnB2, ColumnB3
......................................
And retrieve it as an XML
<TableList>
<TableName>TableA</TableName> <Columns> ColumnA1, ColumnA2, ColumnA3</Columns>
<TableName>TableB</TableName> <Columns> ColumnB1, ColumnB2, ColumnB3</Columns>
</TableList>
How should the SQL Query be written?
This will give you the XML you ask for.
But I think this would return an XML that is easier to handle.
Or perhaps like this.