views:

17

answers:

1

This is query:

CREATE TABLE #TempTable(datasize varchar(200))

INSERT  #TempTable
   EXEC sp_spaceused 'Table1'

When executing this query error message shown as below

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

How can I solve this problem?

+2  A: 

There's a definition mismatch between that temp table and the default output of sp_spaceused.

Use:

CREATE TABLE #TempTable
(
    objName         varchar(200),
    objRows         varchar(200),
    objReserved     varchar(200),
    objData         varchar(200),
    objIndexSize    varchar(200),
    objUnused       varchar(200)
)

INSERT INTO #TempTable
    EXEC sp_spaceused 'Table1'
Brock Adams

related questions