Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Create Views without their dependencies (without dependent objects)


Create Views without their dependencies (without dependent objects)

Author
Message
anupam.jha
anupam.jha
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 114
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
mayurkb
mayurkb
SSC Journeyman
SSC Journeyman (88 reputation)SSC Journeyman (88 reputation)SSC Journeyman (88 reputation)SSC Journeyman (88 reputation)SSC Journeyman (88 reputation)SSC Journeyman (88 reputation)SSC Journeyman (88 reputation)SSC Journeyman (88 reputation)

Group: General Forum Members
Points: 88 Visits: 238
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?
Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16570 Visits: 17016
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)
anupam.jha
anupam.jha
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 114
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
anupam.jha
anupam.jha
Forum Newbie
Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: General Forum Members
Points: 7 Visits: 114
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
mayurkb
mayurkb
SSC Journeyman
SSC Journeyman (88 reputation)SSC Journeyman (88 reputation)SSC Journeyman (88 reputation)SSC Journeyman (88 reputation)SSC Journeyman (88 reputation)SSC Journeyman (88 reputation)SSC Journeyman (88 reputation)SSC Journeyman (88 reputation)

Group: General Forum Members
Points: 88 Visits: 238
If you have ready database then maybe try to reverse engineer and generate the scripts by using SSMS "Create scripts" functionality.
Sean Lange
Sean Lange
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16570 Visits: 17016
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. :-P

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)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search