FOR XML PATH (u wont need to know this) SELECT Name, GroupName From SchemaName.TableName FOR PATH('Main') Creates an XML table with all elements nested within a main tag