1

I'm trying to create a change script for some upcoming changes. We're adding a new schema to the database and our client wants the new schema to make use of a new database file.

How do I, in T-SQL, create the new file and assign the new objects within the schema to use the new file?

We're using SQL Sever 2012.

1
1

You can create a new filegroup, make it DEFUALT, create all schema objects and switch DEFAULT filegroup back. If at any later point you would need to add objects to that schema, you can explicitly specify filegroup through ON filegroup clause for each object in create statement or temporarily switch DEFUALT filegroup.

Alternatively you can explicitly specify ON filegroup for each object of this client's schema.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.