I don’t know why SSMS doesn’t take into account the execution order, but it just doesn’t. This is not a problem for small databases, but what if your database has 200 objects? In this case, the order of execution matters because it is not very easy to go through all of these.
For unordered scripts generated by SSMS, you can follow
a) Run the script (some objects will be inserted into some of them, there will be errors)
b) Remove all objects from the script that have been added to the database
c) Go back to a) until everything is done
An alternative is to use a third-party tool, such as ApexSQL Script or any other tools already mentioned in this thread (SSMS toolpack, Red Gate and others).
All of them will take care of addictions for you and save even more time.
Shawna Jacobs Jun 19 '13 at 8:53 on 2013-06-19 08:53
source share