sp_spacesued output into a table.

  • Hi

    Just trying to make weekly reports for 'Adventure works' database using sp_spaceused (not tables).

    CREATE TABLE [dbo].[SSP_SpaceUsed](

    [LogDate] [datetime] NOT NULL,

    [database_name] [nvarchar](128) NULL,

    [database_size] [varchar](18) NULL,

    [unallocated space] [varchar](18) NULL,

    [reserved] [varchar](18) NULL,

    [data] [varchar](18) NULL,

    [index_size] [varchar](18) NULL,

    [unused] [varchar](18) NULL,

    INSERT [dbo].[SSP_SpaceUsed] EXEC sp_spaceused --also tried with ('adventureWorks')???

    Error: Column name or number of supplied values does not match table definition.

    But not working. Can anyone help?

  • sp_spaceused returns 2 resultsets

    Type the following to see the schema "EXEC sp_helptext sp_spaceused".

    There might be a some DMVs out there that give you the information that you require.

  • see this thread

    Topic1343996-391-1.aspx

  • Here is a script that will make it very easy to get the space used and to insert it into a table.

    http://bit.ly/tablespace

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • I'd love to see INSERT/EXECUTE have the ability to designate which resultset to insert.

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

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