Groups | Blog | Home
all groups > sql server (alternate) > march 2004 >

sql server (alternate) : Tables and File groups


acko bogicevic
3/12/2004 12:18:00 PM

Hi everybody
I need query that will determine which tables are created on primary
file group or secondary file group...
I know that i can exectute sp_help 'tablename' to see on which file
group the only one table is.
But i have 2000 tables and it is very slow to execute sp_help for every
table.
alex

*** Sent via Developersdex http://www.developersdex.com ***
David Portas
3/12/2004 3:36:29 PM
Try this:

SELECT OBJECT_NAME(I.id) AS tablename, G.groupname
FROM sysfilegroups AS G
JOIN sysindexes AS I
ON I.groupid = G.groupid
AND I.indid <= 1

--
David Portas
SQL Server MVP
--

AddThis Social Bookmark Button