Click here to Skip to main content
14,774,351 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
Hi All,
I have a small doubt.
I have a database called NORTHWIND in my Sql Server 2008. In the database i have table called Categories (which is a part of the primary file group). I want to move this table to a secondary file as i don't use this table often.
In what way can I achieve this requirement?
Amir Mahfoozi 1-Feb-12 1:26am
"move this table to a secondary file"
What do you mean ?
puja11191 1-Feb-12 1:42am
Actually when we create a new table it is added to the primary file (.mdf) by default. Now i want to move the table to a secondary file (.ndf) within the same database
puja11191 1-Feb-12 1:43am
I didn't get you??
Rajesh Anuhya 1-Feb-12 2:41am
Not a Clear Question
puja11191 1-Feb-12 5:09am
Sorry for the unclear question. Amir has given a solution kindly go through it. It will help you understand the query also

In general, unless you are running really short on space or performance, you should not worry about moving this table out of your database.

If you, however, feel there is a requirement, you can always move this table to another 'backup' database and drop it from your present one.

Just use Select * Into and the entire table would be copied.
puja11191 1-Feb-12 1:38am
Hi Abhinav,
Actually what you have suggested is quite correct. But my point is that how can i use the secondary file, take it from educational point of view
Open SSMS then right click on your table and select Design View then press F4 in design view to see the properties pane.

In Regular Data Space you can change file group of this table.

Of course you should have defined file groups for your database to see them in that list.

If you want to do that by TSQL then read these pages :[^][^]

Hope it helps.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900