SQL Server 2005 objects question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vajarov

    SQL Server 2005 objects question

    Hi guys,
    I am pretty happy with the new system views in SQL 2005 but there is
    one thing I could not figure out: What is the view that let you see
    what object belongs to what DB? Sorry for the simple question, Cheers,
    G.

  • Erland Sommarskog

    #2
    Re: SQL Server 2005 objects question

    vajarov (vajarov@gmail. com) writes:
    I am pretty happy with the new system views in SQL 2005 but there is
    one thing I could not figure out: What is the view that let you see
    what object belongs to what DB? Sorry for the simple question, Cheers,
    I'm not really sure that I understand it. Objects are either server-bound
    or database-bound. And if it's database-bound, the object is referred to
    by db.schema.name. If you have a single-part name like 'mytable', then
    that object belongs to the current database. (There are some exceptions
    when it comes to the system views itself, but let's ignore that.)


    --
    Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

    Books Online for SQL Server 2005 at

    Books Online for SQL Server 2000 at

    Comment

    • mladjo

      #3
      Re: SQL Server 2005 objects question

      Hi.

      For example:
      USE AdventureWorks
      GO
      SELECT * FROM
      INFORMATION_SCH EMA.columns


      OR you can to do something like this:
      SELECT * FROM SYS.views
      SELECT * from SYS.TABLES


      Comment

      • mladjo

        #4
        Re: SQL Server 2005 objects question

        Hi.


        For example:
        USE AdventureWorks
        GO
        SELECT * FROM
        INFORMATION_SCH EMA.columns
        This chunk of code will select important information. I hope that is the
        answer on your question.

        OR you can do something like this:
        SELECT * FROM sys.views, SELECT * FROM sys.tables, SELECT * FROM
        sys.objects, SELECT * FROM sys.views...


        Comment

        Working...