Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Create Views without their dependencies (without dependent objects) Expand / Collapse
Author
Message
Posted Monday, August 26, 2013 6:21 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, September 3, 2014 2:02 AM
Points: 4, Visits: 84
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
Post #1488348
Posted Monday, August 26, 2013 2:21 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 3:22 PM
Points: 83, Visits: 175
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?
Post #1488492
Posted Monday, August 26, 2013 2:41 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 2:54 PM
Points: 13,228, Visits: 12,705
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 Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1488498
Posted Monday, August 26, 2013 11:45 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, September 3, 2014 2:02 AM
Points: 4, Visits: 84
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
Post #1488557
Posted Monday, August 26, 2013 11:50 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, September 3, 2014 2:02 AM
Points: 4, Visits: 84
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
Post #1488558
Posted Tuesday, August 27, 2013 7:03 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 3:22 PM
Points: 83, Visits: 175
If you have ready database then maybe try to reverse engineer and generate the scripts by using SSMS "Create scripts" functionality.
Post #1488739
Posted Tuesday, August 27, 2013 7:30 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 2:54 PM
Points: 13,228, Visits: 12,705
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 Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1488762
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse