x

set default in filegroups

I created a database TEST contains test.mdf,test_2010.ndf,test_2011.ndf,test_2012.ndf. I should set default for which? why
more ▼

asked Nov 15, 2012 at 12:47 AM in Default

dona gravatar image

dona
30 3 3 3

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first
Typically your default is your main data file (MDF), if you created multiple file groups and assigned your 2010, 2011, and 2012 files to another file group, you would rebuild the clustered index on the filegroup you want the data to exist in. That would partition your data. Not sure what you are trying to accomplish with multiple file groups with year names in them otherwise.
more ▼

answered Nov 15, 2012 at 01:54 PM

Scotty gravatar image

Scotty
350 4 5 5

(comments are locked)
10|1200 characters needed characters left

You set the default so that you dont need to specify which file group to create objects on.

With the below it would create a table on the default filegroup, which if it hasnt been changed will be the PRIMARY file group.

CREATE TABLE DefaultFG ( Col1 INT, Col2 INT )

Now the below will create a table on the 2010 file group

Create Table FG2010 ( Col1 INT, Col2 INT ) ON FG2010

more ▼

answered Nov 15, 2012 at 09:19 AM

anthony.green gravatar image

anthony.green
1.2k 4

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x108

asked: Nov 15, 2012 at 12:47 AM

Seen: 603 times

Last Updated: Nov 15, 2012 at 01:54 PM