SP result to table

  • Hai,

    If i execute sp_helpdb , gives only singe result set and i used to take it into the table using

    insert into #tab1 Exec sp_helpdb

    How can i take the result of sp_helpdb <dbname> to a table (since this gives two result set)

    pls help


    subban

  • Hi,

    try the following script

    select * into #tmp1

    from openquery(ZZZSERVER,'set fmtonly off;exec master.dbo.sp_helpdb')

    select * from #tmp1

     

    Good Luck!

  • but i am getting the error while executing the query

    select * from openquery(general,'set fmtonly off;exec master.dbo.sp_helpdb')

     

    Server: Msg 7411, Level 16, State 1, Line 1

    Server 'general' is not configured for DATA ACCESS.


    subban

  • In this case try the following proc first:

    exec sp_serveroption 'ServerName', 'data access', 'true'

    Did it help?

  • Greate.. thanks a lot

     

    but what actully this set fmt only off does... i am not able relate this result with what is written in BOL


    subban

  • On my oppinion  it is needed to keep the query from returning metadata only. I had this problem a  little bit  earlier than you so somewhere I found out this. The BOL doesn't tell a lot about this as an internet too

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

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