I have a bit of a conundrum I need to deal with, and I'm trying to find a good solution to it. I'm using MS SQL server 2005, and given a table where a uniqueidentifier column contains a data key to other information on the server. What I need to do is select every row in this datatable (sproc from ASP.NET), but separated into tables based on this one column. For example, from
------------------------------------
MyID | MyOtherData
------------------------------------
4 asdf
4 test
3 qwerty
2 morestuff
I'd want the following three tables returned:
------------------------------------
MyID | MyOtherData
------------------------------------
4 asdf
4 test
------------------------------------
MyID | MyOtherData
------------------------------------
3 qwerty
------------------------------------
MyID | MyOtherData
------------------------------------
2 morestuff
How would be the best way for me to go around this, if I don't know how many unique MyID values there will be ahead of time?