Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 12th, 2004, 08:06 AM
Authorized User
 
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default Tables and File Groups

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
 
Old March 12th, 2004, 08:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

There's probably a nicer way to do it, but this seems to work:

SELECT DISTINCT sysobjects.name, sysfilegroups.groupname
FROM sysobjects
INNER JOIN sysindexes ON sysobjects.id = sysindexes.id
INNER JOIN sysfilegroups ON sysindexes.groupid = sysfilegroups.groupid
WHERE (sysobjects.xtype = 'U')
 
Old March 12th, 2004, 09:38 AM
Authorized User
 
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks
alex





Similar Threads
Thread Thread Starter Forum Replies Last Post
Import a XML file into SQL Server tables Cha BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 0 April 1st, 2008 09:54 PM
Query to extract data from 2 tables of .mdb file Subuana Beginning VB 6 6 March 16th, 2006 04:37 PM
Groups Ma7T XSLT 1 August 25th, 2005 12:01 PM
Linked Tables using file DSN Axra Access VBA 2 February 16th, 2005 02:05 PM
Groups help in 8.5 for VS.net risu Crystal Reports 0 March 15th, 2004 04:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.