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.
Add a comment
|
1 Answer
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.
5 Comments
Eric
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.
Eric
Here's a screenshot of my setting <img src="i.sstatic.net/jxVcv.png" width=300 height=200>
Eric
Looking at the description for that setting it looks like a bug: Script file groups Specify the ON <filegroup> for table definitions.
Dan Guzman
@Eric, SSMS honors the setting for me using the current SSMS 18.2 version.
AjV Jsy
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.