How to filter columns from result set of a system sp

  • is it possible to apply filter on result set produced by a system sp? For example i have used a system stored procedure sp_fkeys tablename

    It produced several columns in result, and i am interested in just one or a couple of columns. Is there any way to get my required column out of that result set?

    Regards

    DBDigger Microsoft Data Platform Consultancy.

  • 2 ways I can think of

    1. Create a table manually, then

    INSERT INTO @table

    exec sp_fkeys XXX

    2. sp_helptext sp_fkeys to find the source code

    then customize the source code for your need

    SQLServerNewbieMCITP: Database Administrator SQL Server 2005
  • Jerry has some good ideas. I'd dig into and see if the procedures that you are looking at have additional parameters. Some do which might help in cases. This one won't remove columns, but what are you trying to achieve by removing columns?

  • For a report application, i have to get table names where foreign key from a table is being used. For this purpose i was looking an optimized way to get list of tables where pk from a given table is going as a foreign key.

    DBDigger Microsoft Data Platform Consultancy.

  • Jerry, i have found it interesting to use your second idea of using sp_helptext sp_fkeys. Please guide me further that how to implement it for code customization?

    DBDigger Microsoft Data Platform Consultancy.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply