September 22, 2009 at 3:50 pm
Hi,
I know that someone has probably done this but I'm having no lucking finding anything.
We are creating a new company division. This requires that all the objects in our standard division database be replicated in a new database. The trick is that most SPs, Views and Triggers have some dependencies on each other. So, I need to export the Create scripts for these objects in the correct order so that that I can just paste and go in the new database.
Does anyone have a script that does that?
thanks.
September 23, 2009 at 7:20 am
Generating scripts in SSMS will automatically be generated in the corrrect order.
Just right-click on the Database > Tasks > Generate Scripts.
September 23, 2009 at 8:36 am
i don't remember the scripts coming out in order, I'm testing it now...the wierd thing is, on a decent size database, with 2000+ objects, it's still running the Script wizard for over an hour....on TWO different servers, since i thought maybe it was just me.
I did notice it is going thru the objects in object type, then alphabetical order, but it might be arranging the data in dependancy order...not sure yet.
the easiest way to get all your objects in order is to run this command:
EXEC sp_msdependencies @intrans = 1
I've used this to manually script all my objects via TSQL...tables, functions/procs/views.
Lowell
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply