Reputation: 8477
I'm creating a build script for a database and building the views in alphabetical order. An issue I've run into is that a view is created before a view that is referenced in the definition. The referenced view is created later in the script. Is there a command I can use that would create a view without validating, i.e. ignore the dependencies?
Note: Stored Procedures have the concept of "deferred name resolution" but I don't see a way of using this for views.
Upvotes: 3
Views: 5471
Reputation: 56789
To add to @Joe Stefanelli's comment, there are many ways to script SQL objects in the correct order of dependency.
Another poor man's solution is just to run the script as many times as you have layers of dependencies. Existing objects would be ignored, and each execution would create more objects that depend on earlier-created objects. I would not recommend this solution if at all possible to find something more direct, as mentioned in the list above.
Upvotes: 2