[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Bragadiru

3/13/2007 12:52:00 PM

Hi all,

How can I get programatically the tables on which my sql view depends ??

Now I'm using .NET Framework 2.0 and Sql.Dmo to get the CREATE VIEW ...
script (using SqlDmo.View.Script), but I need to get the table names, too,
to create tables first.

Thanks for any advice


3 Answers

Uri Dimant

3/13/2007 12:58:00 PM

0

Hi
http://dimantdatabasesolutions.blogspot.com/2007/03/script-ob...
--T-SQL
use northwind
go
create view my_view as
select orderid from orders o join
customers c
on o.customerid=c.customerid
go
select text from syscomments
where id=object_id('my_view')
go






"Bragadiru" <bragadiru@hotmail.com> wrote in message
news:eeWc35WZHHA.1300@TK2MSFTNGP02.phx.gbl...
> Hi all,
>
> How can I get programatically the tables on which my sql view depends ??
>
> Now I'm using .NET Framework 2.0 and Sql.Dmo to get the CREATE VIEW ...
> script (using SqlDmo.View.Script), but I need to get the table names, too,
> to create tables first.
>
> Thanks for any advice
>
>


Tibor Karaszi

3/13/2007 2:17:00 PM

0

Check out sp_depends. Also check out sp_refreshsqlmodule (new in SQL 2005 sp2).

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/d...
http://sqlblog.com/blogs/tib...


"Bragadiru" <bragadiru@hotmail.com> wrote in message news:eeWc35WZHHA.1300@TK2MSFTNGP02.phx.gbl...
> Hi all,
>
> How can I get programatically the tables on which my sql view depends ??
>
> Now I'm using .NET Framework 2.0 and Sql.Dmo to get the CREATE VIEW ...
> script (using SqlDmo.View.Script), but I need to get the table names, too,
> to create tables first.
>
> Thanks for any advice
>
>

Bragadiru

3/14/2007 9:23:00 AM

0

Thanks a lot for your response.

Also I found the method in SqlDmo :
SQLDMO.QueryResults qr =
SQLDMO.View.EnumDependencies(SQLDMO.SQLDMO_DEPENDENCY_TYPE.SQLDMODep_Parents);



"Bragadiru" <bragadiru@hotmail.com> wrote in message
news:eeWc35WZHHA.1300@TK2MSFTNGP02.phx.gbl...
> Hi all,
>
> How can I get programatically the tables on which my sql view depends ??
>
> Now I'm using .NET Framework 2.0 and Sql.Dmo to get the CREATE VIEW ...
> script (using SqlDmo.View.Script), but I need to get the table names, too,
> to create tables first.
>
> Thanks for any advice
>
>