March 12, 2004 at 5:14 am
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
March 12, 2004 at 9:03 am
I hope this gets you started :
SELECT sysFile.groupid AS GroupID
, SUBSTRING(sysFile.groupname,1,30) AS FilegroupName
, SUBSTRING(sysObj.name,1,30) AS ObjectName
FROM sysobjects sysObj
INNER JOIN sysindexes sysIdx
ON sysObj.id = sysIdx.id
INNER JOIN sysfilegroups sysFile
ON sysIdx.groupid = sysFile.groupid
WHERE sysIdx.indid = 0 -- only heaps
and sysObj.xtype = 'U'
ORDER BY sysFile.groupname, sysObj.ObjectName
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
March 15, 2004 at 6:14 am
thanks
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply