• well, i've got this saved in my snippets to find tables by filegroup:

    SELECT

    objz.[name] As TableName,

    objz.[type],

    idxz.[name] As IndexName,

    idxz.[index_id],

    CASE idxz.[index_id]

    WHEN 0 THEN 'HEAP'

    WHEN 1 THEN 'CLUSTERED'

    ELSE 'NON-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

    ORDER BY

    CASE

    WHEN filz.[name] = 'PRIMARY'

    THEN 2

    ELSE 1

    END,

    FileGroupName

    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

    Lowell


    --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!