October 24, 2014 at 9:59 am
Hello. I need to copy all objects (views, procedures, tables, functions, etc -- no data) that are under a specific Schema in a database, but the Generate Script option in SSMS doesn't give me the option to do this. Does anyone know how I can generate a script that's Schema specific?
Thanks.
October 24, 2014 at 10:11 am
you could use Visual Studio with a database project and Schema Compare
Gerald Britton, Pluralsight courses
October 27, 2014 at 7:15 am
It's a bit manual but if you are talking about the rightclick on db, Tasks, Generate Scripts option, you can go through that and select everything in the schema, in the GUI (it should be ordered by schema). If you're talking thousands of objects may not be worth it though. But if a smaller number of objects that would save you time versus manually going through and scripting out each object individually. For higher volume the VS/SSDT option may be better.
Or, just thinking through this...restore a copy of the database somewhere else, and write a script to drop all objects except those in your targeted schema, and then script out all objects. Kind of hamfisted I admit but I bet it would work!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply