Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Location
    Hungary
    Posts
    1

    Red face Unanswered: Working in a stored procedure's result set in MSSQL 2000 (eg.: selecting from)

    Hy all.
    My main goal would be to create some kind of map of the database, wich contains information of all connecting fields, including wich fields has key references to the other one and wich table. I'd like to have a table wich shows all the database connections tablename, field, field/table_key (from or to the key points), field_key_type (prymary or foreign)
    So I thaugh to get sp_fkeys and sp_pkeys from master table and inner joining their results, but I simplay cannot "catch" their result sets. The script must have been written in SQL.
    Obviously I'd like to do this:
    SELECT * FROM EXEC sp_fkeys @table_name = 'xy'
    of course it is not working this way, but I'd like something like this.


    Please help! Thanx!

  2. #2
    Join Date
    Feb 2004
    Location
    Chester Springs, PA
    Posts
    16

    Re: Working in a stored procedure's result set in MSSQL 2000 (eg.: selecting from)

    Originally posted by EliasT
    Hy all.
    My main goal would be to create some kind of map of the database, wich contains information of all connecting fields, including wich fields has key references to the other one and wich table.

    Please help! Thanx!
    Write your own stored procedures which join the sysobjects, syscolumns and sysforeignkeys to cobble this together. These are all documented in the Books Online.

  3. #3
    Join Date
    Feb 2004
    Location
    Chester Springs, PA
    Posts
    16

    Re: Working in a stored procedure's result set in MSSQL 2000 (eg.: selecting from)

    Originally posted by EliasT
    Hy all.
    My main goal would be to create some kind of map of the database, wich contains information of all connecting fields, including wich fields has key references to the other one and wich table.

    Please help! Thanx!
    Write your own stored procedures which join the sysobjects, syscolumns and sysforeignkeys to cobble this together. These are all documented in the Books Online.

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Go to MASTER database in QA, expand Stored Procedures, right-mouse on a procedure of your choice, and select Script Object to New Window As ->Create. See how it's done there and pull out the needed SELECT.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •