well, i've got this saved in my snippets to find tables by filegroup:
objz.[name] As TableName,
idxz.[name] As IndexName,
WHEN 0 THEN 'HEAP'
WHEN 1 THEN 'CLUSTERED'
END AS index_type,
filz.[name] As FileGroupName
FROM sys.indexes idxz
INNER JOIN sys.filegroups filz
ON idxz.data_space_id = filz.data_space_id
INNER JOIN sys.all_objects objz
ON idxz.[object_id] = objz.[object_id]
WHERE idxz.data_space_id = filz.data_space_id
AND objz.type_desc IN( 'USER_TABLE') -- User Created Tables
WHEN filz.[name] = 'PRIMARY'
beyond that, i'd modify a cursor that looks link of like the one in books online, so that the did it in a specific order, or was limited to a specific filegroup?http://msdn.microsoft.com/en-us/library/ms177571.aspx
--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!