Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 7,2000
»
T-SQL
»
SQL 2000 query to populate temp table using...
SQL 2000 query to populate temp table using EXEC sp_spaceused
Rate Topic
Display Mode
Topic Options
Author
Message
melloman
melloman
Posted Wednesday, February 13, 2013 10:35 AM
Forum Newbie
Group: General Forum Members
Last Login: Wednesday, March 13, 2013 6:58 AM
Points: 3,
Visits: 15
Hi,
I was wondering if you could help me.
I was wondering how to populate the output of SQL2000 sp_spaceused into a temp table (#t). But my flowing T-SQL query fails:
CREATE TABLE #t
(database_name VARCHAR(20), database_size VARCHAR(18), [unallocated space] VARCHAR(18),
reserved VARCHAR(18),data VARCHAR(18), index_size VARCHAR(18), unused VARCHAR(18)
)
select * from #t
--EXEC sp_spaceused
INSERT INTO #t (database_name, database_size, [unallocated space], reserved, data, index_size,unused) EXEC sp_spaceused
--drop table #t
error mgs on running I get:
Server: Msg 213, Level 16, State 7, Procedure sp_spaceused, Line 148
Insert Error: Column name or number of supplied values does not match table definition.
Can anyone help?
Post #1419653
Michael Valentine Jones
Michael Valentine Jones
Posted Wednesday, February 13, 2013 11:29 AM
SSCrazy
Group: General Forum Members
Last Login: Yesterday @ 10:01 PM
Points: 2,944,
Visits: 10,504
This script provides a good example of what you are trying to do.
Script is used to analyze table space usage using the output from the sp_spaceused stored procedure
Works with SQL 7.0, 2000, 2005, 2008, 2008 R2. May work with 2012, but I havn't tested it there.
Script to analyze table space usage
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=61762
Post #1419668
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.