I have to query a view and include only those columns which are defined in the XML which comes as a parameter to my SP. Can i include that XML in select clause and extract all columns defined in that XML. Please tell a way to do this.
XML format is
<Columns>
<Column Name="CustomerID"/>
<Column Name="CustomerName"/>
<Column Name="Customerstate"/>
</Columns>
I want to put these columns in select list.
SELECT row.value('@Name', 'varchar(200)')
FROM @varXML.nodes('Columns/Column') AS d (row) FROM JobListingDetails