How to copy All data from sp_helpdb to some other table

  • Hi All,

    I am trying to copy All data from sp_helpdb to some other table. I am not finding any solution that how to do this.

    Can someone help on this.

  • The information you see in sp_helpdb can be found in the system dmv's. Start with looking at sys.databases and go from there. Be sure to check out each dmv in Books Online as it will lead you to other views and more information.

  • To save stored procedure values you can do something as follows:

    CREATE TABLE #MYTEST(xNAME sysname, xDB_SIZE nvarchar(13), xOWNER SYSNAME, xDBID smallint, xCREATED nvarchar(11), xStatus nvarchar(600), xCOMPATIBILITY_LEVEL TINYINT)

    INSERT INTO #MYTEST(xNAME, xDB_SIZE, xOWNER, xDBID, xCREATED, xStatus, xCOMPATIBILITY_LEVEL)

    EXEC sp_helpdb;

    SELECT * FROM #MYTEST

    HTH 🙂

  • Sp_help returns multiple data sets with different numbers of columnz. It also returns different results depending on the parameters and the object you are testint... a table returns diilfferent results than proca or views.

    You can sp_kelptext sp_help and reshape the results into something more easily squabs shed into a single resultset by making a new procedure.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Lowell (3/30/2013)


    Sp_help returns multiple data sets with different numbers of columnz. It also returns different results depending on the parameters and the object you are testint... a table returns diilfferent results than proca or views.

    You can sp_kelptext sp_help and reshape the results into something more easily squabs shed into a single resultset by making a new procedure.

    eh? what? I wouldn't use sql server to squab a shed.

    spellchecker my son.

    :-):-D;-)

    ---------------------------------------------------------------------

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

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