How to create and use the File and File Group in Sql Server 2008.

Allemahesh
Posted by in Sql Server category on for Intermediate level | Points: 250 | Views : 6970 red flag

This article will explain how to create and use the File and File Group in SQL Server 2008.

What are Database Files and File groups?

For this question you can see the link: http://technet.microsoft.com/en-us/library/ms189563.aspx


How to create Files and File Groups?

Please see the below steps to understand how to create files and files groups.


STEP 1: Create a File Group Folder.

Create a folder where you need to store this new file group. Create a “DemoFileGroup” folder in D: drive. i.e D:\DemoFileGroup


STEP 2: Create a Database.

Now create a “Demo” database by using Right Click -> New Database. It will open the New Database window. Please see the image for further details.



Now click on “Add” button to add “New” the File and File Groups to this Database. It will add a new row at bottom. See the below images.




After that Click on File group drop down list. It will give you all the available file groups. 
Now select the <new filegroup>.




It will open the New Filegroup for Demo window. Enter the “DemoFileGroup” name. Then click on “Ok” button.



Then choose the file path as “D:\DemoFileGroup” which is created in STEP 1.




Give the File Name as “DemoFile.ndf”. See the below Image.




After this you File group will be automatically created. See the below images.




Finally click on “OK” button. The database is created successfully with you new file group.






Assign File group to table.


Create an “Emp” table as shown in the below:-



After creating the table, edit the table and go to his properties window. See the below figure.



Change the filegroup or partition to “DemoFileGroup” and save the table. That’s all.


Conclusion

Hope you will enjoy this article. Please provide the suggestions on this article in comments section.


Page copy protected against web site content infringement by Copyscape

About the Author

Allemahesh
Full Name: MAHESH ALLE
Member Level: Silver
Member Status: Member,MVP
Member Since: 4/2/2012 1:34:42 AM
Country: India



Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)