0

I'm trying to do use the Tasks->Generate Scripts to create a backup of the metadata on a SQL server and then run it to create an empty copy of the database on my development machine. The problem is that the source SQL Server has Filegroups and I don't on my local machine, so when I run the query I get errors regarding the non existent filegroups. Is there a way in the advance options or something to have SQL Server remove the filegroup information? I can manually search and replace stuff like ON [FG1] with an empty string, but this is tedious and error prone.

1 Answer 1

1

SSMS Object Explorer scripting options are configurable from the menu bar under Tools-->Options-->SQL Server Object Explorer-->Scripting. Change the "Script file groups" under the "Table and view options" to False.

Sign up to request clarification or add additional context in comments.

5 Comments

I tried that but when I do a Tasks -> Generate Scripts and tick just the "Tables" in "Select specific database objects" I still see stuff like ON [FG1] in my queries. This seems like it would be exactly what unchecking the "Script file groups" under the "Table and view options" should do. I've tried restarting the SSMS and verified that "Script file groups" is still set to false before I generate the script.
Here's a screenshot of my setting <img src="i.sstatic.net/jxVcv.png" width=300 height=200>
Looking at the description for that setting it looks like a bug: Script file groups Specify the ON <filegroup> for table definitions.
@Eric, SSMS honors the setting for me using the current SSMS 18.2 version.
SSMS 18 here, suffering same problem. Looking at having to create two sets of scripts, one to create the tables, small enough that we stand a chance of editing them (possibly created without keys with a dedicated script to add them manually), and the second set of massive scripts of INSERTs that won't need to be touched.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.