Wednesday, March 7, 2012

How to store the result?

Hi,
If I want to store the result of "sp_spaceused XXX" into a table? What
shall I do?
Thanks a lot!
Michael
CREATE TABLE #foo
(
tablename SYSNAME,
[rows] INT,
reserved VARCHAR(32),
data VARCHAR(32),
index_size VARCHAR(32),
unused VARCHAR(32)
);
INSERT #foo EXEC sp_spaceused 'table_name';
SELECT * FROM #foo;
DROP TABLE #foo;
Aaron Bertrand
SQL Server MVP
http://www.sqlblog.com/
http://www.aspfaq.com/5006
"Michael" <michaelnx@.gmail.com> wrote in message
news:1176318829.693610.312820@.b75g2000hsg.googlegr oups.com...
> Hi,
> If I want to store the result of "sp_spaceused XXX" into a table? What
> shall I do?
> Thanks a lot!
> Michael
>
|||On Apr 11, 4:26 pm, "Aaron Bertrand [SQL Server MVP]"
<ten...@.dnartreb.noraa> wrote:
> CREATE TABLE #foo
> (
> tablename SYSNAME,
> [rows] INT,
> reserved VARCHAR(32),
> data VARCHAR(32),
> index_size VARCHAR(32),
> unused VARCHAR(32)
> );
> INSERT #foo EXEC sp_spaceused 'table_name';
> SELECT * FROM #foo;
> DROP TABLE #foo;
> --
> Aaron Bertrand
> SQL Server MVPhttp://www.sqlblog.com/http://www.aspfaq.com/5006
> "Michael" <michae...@.gmail.com> wrote in message
> news:1176318829.693610.312820@.b75g2000hsg.googlegr oups.com...
>
>
>
> - Show quoted text -
Thank you very very much!!!

No comments:

Post a Comment