I'm generating creation script for my Views through the Task option in SQL Server Management Studio 2008.
When I run the script it fails because I have Views depending on other Views that are further down in the script. For example, View1 depends on View2, but View2 does not get created until further down in the script. So when the create statement for View1 is running it fails because of View2 does not exist yet.
This is a legacy system and it's not so easy to go through and remove View dependencies.
I can go through the script to move the statements around but I have 100+ views and it's not feasible to do this every time the script is generated. The script I generate is an evolving script with each version released.
Does anyone know how to get the management studio to create the view scripts with dependencies in consideration? Or other ways to easily generate the scripts with a few clicks of the mouse?