Hi Friends,

Below is the simple T-SQL to create File Group and Files for a database and adding multiple files under that file group. Here you can specify values as per your requirement like:

1- Database Name under which you wants to add file group.
2- Name of the file group.
3- Number of files, you wants to create under the file group.
4- Path where these files will be stored.
5 Initial allocated Size and growth size for each file.

If you want, You can modify the code to pass all these values through parameters. Keep in mind to change the values as per your requirement before using it.

I used this to create a file group and files for my test database. Below is the image which shows, those created file group and files.



Prince Kumar Rastogi

Like us on FaceBook | Join the fastest growing SQL Server group on FaceBook

Follow Prince Rastogi on Twitter | Follow Prince Rastogi on FaceBook