Sunday, 11 January 2015

Rolling up multiple rows into a single row and column for SQL Server data

If you want all of the data concatenated into a single column in a single row. In this tip we look at a simple approach to accomplish this.

 we can use the FOR XML PATH option to return the results as an XML string which will put all of the data into one row and one column.

SELECT PatFullName FROM IE_Patients
FOR XML PATH('')


No comments: