August 26, 2013 at 6:21 am
I need to create around 26000 Views whose scripts are ready.
But, some of the views are dependent on other views. Thus, I am not able to create the Views all at once.
How should i automate the view creation process and avoid any errors that may come due to non existence of the dependencies.
Please Help.
Thanks,
AJ
August 26, 2013 at 2:21 pm
anupam.jha (8/26/2013)
I need to create around 26000 Views whose scripts are ready.But, some of the views are dependent on other views. Thus, I am not able to create the Views all at once.
How should i automate the view creation process and avoid any errors that may come due to non existence of the dependencies.
Please Help.
Thanks,
AJ
Why can't you create them in correct order?
August 26, 2013 at 2:41 pm
anupam.jha (8/26/2013)
I need to create around 26000 Views whose scripts are ready.But, some of the views are dependent on other views. Thus, I am not able to create the Views all at once.
How should i automate the view creation process and avoid any errors that may come due to non existence of the dependencies.
Please Help.
Thanks,
AJ
How many levels are they nested? What you are running into is why so many people can't stand nested views. It is a maintenance nightmare.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 26, 2013 at 11:45 pm
Firstoff, Thanks for your response.
The reason, I am not able to create them in correct order is that since I have already generated the scripts of the Views (which are not ordered correctly), If at all I try to fix the ordering manually, it will consume a lot of time.
Hope this answers your question.
Regards,
AJ
August 26, 2013 at 11:50 pm
Sean Lange (8/26/2013)
anupam.jha (8/26/2013)
I need to create around 26000 Views whose scripts are ready.But, some of the views are dependent on other views. Thus, I am not able to create the Views all at once.
How should i automate the view creation process and avoid any errors that may come due to non existence of the dependencies.
Please Help.
Thanks,
AJ
How many levels are they nested? What you are running into is why so many people can't stand nested views. It is a maintenance nightmare.
Right! This is a nightmare situation.
Perhaps the project which I am working on is a legacy system and it seems that the entire development is done in bits and pieces without considering such maintenance issues.
Anyways, most of the views have 1 level of dependency but there are views which have multiple level of dependencies.
Regards,
AJ
August 27, 2013 at 7:03 am
If you have ready database then maybe try to reverse engineer and generate the scripts by using SSMS "Create scripts" functionality.
August 27, 2013 at 7:30 am
anupam.jha (8/26/2013)
Sean Lange (8/26/2013)
anupam.jha (8/26/2013)
I need to create around 26000 Views whose scripts are ready.But, some of the views are dependent on other views. Thus, I am not able to create the Views all at once.
How should i automate the view creation process and avoid any errors that may come due to non existence of the dependencies.
Please Help.
Thanks,
AJ
How many levels are they nested? What you are running into is why so many people can't stand nested views. It is a maintenance nightmare.
Right! This is a nightmare situation.
Perhaps the project which I am working on is a legacy system and it seems that the entire development is done in bits and pieces without considering such maintenance issues.
Anyways, most of the views have 1 level of dependency but there are views which have multiple level of dependencies.
Regards,
AJ
I assumed that with 26,000 views it wasn't a brand new system. 😛
Is this a one time thing or something you need to do repeatedly? If it is a one time thing you can use the catalog views to determine which of your views have dependencies to objects that are views. Then rearrange your script so that you create all the "base level" views first, followed by the next level. Rinse and repeat if you have multiple nested levels.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply