2

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?

1
  • Here is a poor way to do this..Run the script as many times till you dont get all the objects created in your new system...for better answer please see stackoverflow.com/questions/6713564/… Commented Oct 19, 2012 at 5:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.