Re: Getting relationship data

From: Anith Sen (anith_at_bizdatasolutions.com)
Date: 06/07/04

  • Next message: the_devhead: "Re: MS KBN 830767; SQL Query Analyzer Stops Responding"
    Date: Mon, 7 Jun 2004 12:30:10 -0500
    
    

    You can start by querying INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS view.
    If you are interested in viewing the reference constraints that exist in
    your database, you can do:

    SELECT o1.name AS "tablename",
           OBJECT_NAME( f1.constid ) AS "constraintname",
           OBJECT_NAME( f1.rkeyid ) as referencedtable
      FROM sysobjects o1
      LEFT OUTER JOIN sysconstraints c1
        ON o1.id = c1.id
       AND c1.status &3 = 3
      LEFT OUTER JOIN sysforeignkeys f1
        ON c1.constid = f1.constid
     WHERE o1.type = 'u'
     ORDER BY "referencedtable", "tablename" ;

    -- 
    Anith
    

  • Next message: the_devhead: "Re: MS KBN 830767; SQL Query Analyzer Stops Responding"

    Relevant Pages

    • Re: Tuning Experts
      ... The database is on a remote ... 11 osi left outer join usr asgnusr on ... 197285 bytes received via SQL*Net from client ... Does the database have a 2KB block size? ...
      (comp.databases.oracle.server)
    • derived field problem
      ... The database is SQLServer. ... The first field is a difference of 2 dates. ... SELECT CAST(PFCL.DaysStatusChanged as Int) as "DaysStatusChanged", ... dbo.Bank.BankNumber LEFT OUTER JOIN ...
      (microsoft.public.data.ado)
    • Re: urgent ! outer join not picking all records
      ... I did just now change that option for the database I'm working with, ... results are the same - I'm still not getting true outer join results. ... "Van T. Dinh" wrote: ... you are using JET syntax which is different. ...
      (microsoft.public.access.queries)
    • SMSS SP2 Script Database objects error
      ... Generate Script Progress ... Determining objects in database 'NameHost' that will be scripted. ... (LEFT OUTER JOIN, RIGHT OUTER JOIN). ... In the future versions of SQL Server, ...
      (microsoft.public.sqlserver.tools)
    • RE: newbie, querie help/advice
      ... dbo.STUDENT.Student_ID LEFT OUTER JOIN ... where course_name = 'database' ... > Which students are enrolled in both Databases and Networking? ... > Student_ID int NOT NULL, ...
      (microsoft.public.sqlserver.programming)