Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Posts
    369

    Unanswered: How to export space report to web page or Excel from T-SQL script

    I have the t-sql script that generates database report of space used for 200 databases on MS SQL Server 2000. How can I dump the contents of this report to an Excel spreadsheet and/or a Web page html file?

    -- Space Usage report for MS SQL Server 2000 databases
    USE MASTER;
    GO
    EXEC sp_msforeachdb @command1="use [?] exec sp_spaceused"

    Thanks!

    Scott

  2. #2
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    it's kind of ugly for this query, because each call to sp_spaceused returns two different record sets.

    However you can force it into excel by setting "results to text" in QA and then choosing comma delimited, and finally uncheck the "include column headers" setting in QA. at least I think that setting exists in QA. I know it exists in SSMS.

    then just execute the result to text, copy paste into a .csv file, open in excel.

    If I were you though, I might cosider cracking open the sql of sp_spaceused and creating my own sproc that returns one record set per db, instead of 2. that would be more appropriate for a csv.

  3. #3
    Join Date
    May 2003
    Posts
    369

    Need more help

    Hi,

    How would I do this? I am an Oracle DBA and not too experienced on SQL Server 2000. How would I dump the contents of the stored proc to a flat file or to Excel? Do I need to use xp_cmdshell? Is there a way to generate a web page report within SQL Server 2000 of all the database sizes and space usage?

Posting Permissions

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