Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Sep410
Posting Yak Master
117 Posts |
Posted - 2008-05-27 : 17:19:21
|
| HiI need to edit a database. I have to delete all the views which are not used in any other views or stored procedures. Is there any kind of shortcut to help me figure out which view is not used in any other views or stored procedures? Thanks |
|
|
Sep410
Posting Yak Master
117 Posts |
Posted - 2008-05-27 : 18:41:41
|
| I found this:SELECT table_name ,view_definitionFROM INFORMATION_SCHEMA.viewsWHERE (view_definition LIKE '%NameOfYourView%')It is not what I need but it is better than nothing and manually checking. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-05-27 : 18:43:34
|
| Search syscomments instead.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx |
 |
|
|
Sep410
Posting Yak Master
117 Posts |
Posted - 2008-05-27 : 18:53:55
|
| Can you explain more? |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-05-27 : 18:58:02
|
| If you use INFORMATION_SCHEMA.VIEWS, you'll miss the stored procedures and functions. If you use INFORMATION_SCHEMA.ROUTINES, you'll miss the views. You could use both and get all 3, but then why not just use syscomments instead as it contains the code for all 3 types.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx |
 |
|
|
|
|
|