-
Sqldmo
Is it possible to script views in SQL 2k using SQLDMO 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).
-
-
You have to figure out the dependency (which can be done using DMO) and script each one in that order. It isn't fun, I tried to do that once, and gave up after about a week trying to get it right (I was scripting tables AND stored procs AND FKeys, etc...)
TG
-
It has been a royal pain in my . . ., well, you get the picture. I can't seem to get the dependencies from DMO. If I can get the dependencies I'm sure I could create a procedure to script them in the order that I need them. Any ideas or suggestions on getting the dependencies from DMO?
-
Let me dig around, I know I've got that code some where. If I can find it, I'll post it.
Tg
-
Crap, I must have killed that proj when I couldn't get it to do what I wanted.... but I have the info you need.
The View (and View2) object of SQLDMO has a proerty EnumDependancies, which returns an object of QueryResults that you can loop through to see what it's dependant on. According to the help though, this list will also include objects that are dependant on that view. If remember right, there is a type col in the query results which you should be able to use to determine which type of dependancy it is.
Hope it helps.
TG