SQL Server Performance

How to retrieve the table names from a View using SMO

Discussion in 'SQL Server 2008 General Developer Questions' started by babuman1, Jun 28, 2011.

  1. babuman1 New Member

    I am writing a User Interface to view all the SMO.View objects and display the components involved in it. One of the issues I am having is to retrieve all the tables involved in an existing View. I can see all the columns involved. But the Column.Parent only points to the View itself. I need the names of the tables for each column including their alias if any. I can see this information in the View.TextBody. I can also see the column information by calling View.EnumColumns(). But I can't find the table information anywhere. I am sure this information is stored somewhere in the view or elsewhere on the database. Can someone help me with this please? I really appreciate it.

    Babu.
  2. satya Moderator

    Welcome to the forums.
    I believe the SQL Server books online is best friend for you in this case to go through the information about the namespaces and required programming concepts in using SMO. See http://msdn.microsoft.com/en-us/sqlserver/cc514207 for more information.

Share This Page