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 |
MichaelC
Starting Member
5 Posts |
Posted - 2004-07-21 : 10:20:02
|
Is it possible to script views in SQL 2k using SQLDMO and Visual Basic in order of their dependencies? For example, if I have three veiws (A, B, C) and A uses C and C uses B, is it possible to script the views in the order they are used (B, C, A). The default order of scripting appears to be (A, B, C). |
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2004-07-21 : 13:13:47
|
Not that I know of,You could use sp_depends to find out dependencies before sripting.I have seen thigs on the web that finds out dependencies between objects...(FYI)...Google gave this: ( just serched "sysdepends sp_depends finding" )http://dotnetjunkies.com/WebLog/seichert/archive/2003/06/11/246.aspx/rockmoose |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-07-21 : 13:31:49
|
sp_depends, which in turn relies on sysdepends, is very unreliable. If an object is created which depends on a child object sometimes the object is created, but sysdepends doesn;t get updated. When the child is subsequently created the parent object still doesn't get updated in sysdepends, but because the parent object now works properly nothing appears to be amiss.create view Test2Viewasselect * from sysobjectsgocreate view TestViewasselect * from Test2Viewgoexec sp_depends 'testview'go-- Lots of stuff displayeddrop view Test2Viewgoexec sp_depends 'testview'go-- Nothing displayed, fair enoughcreate view Test2Viewasselect * from sysobjectsgoexec sp_depends 'testview'go-- Nothing displayed, Oh Dear!SELECT TOP 10 * FROM testviewGO-- Lots of stuff displayed, but apparently "testview" has no dependancies - Oh dear!DROP VIEW Test2ViewGODROP VIEW TestViewGO Kristen |
|
|
|
|
|
|
|