I would like to write a T-SQL statement, that structures data to be loaded into a Ado.Net DataSet like it was possible with the ADO SHAPE command. Is there something similar in T-SQL?
My idea is to select multiple rows from a main table and all related records from a child table. That data would get loaded in to a DataSet and then I would create relations and use GetChildRows().
The most straight forward solution would be to select records from the main table into a temp table and then use "select * from child_table where ParentID in (select Id from #temp)". But in more complex scenarios the code will become quite ugly.
Is there a better solution available?