StorProc Help

Jul 18, 2001

Hi All,

I am trying to report the freespace on ALL database in a server (as can be obtained from one database using sp_spaceused). I have adapted the sp_spaceused procedure to give me the following output:

database_name database_size unallocated_space
----------------------------------------------------------
<database name> <value> <value>

I have created a cursor that takes the database name values from sp_databases and then uses the value from the cursor as a variable when executing the sp_spaceused stored proc. To execute in the stored proc this requires the 'USE <database> EXEC master..sp_spaceused.

This gives me the correct information but in the following output:

database_name database_size unallocated_space
----------------------------------------------------------
<database 1 name> <value> <value>

database_name database_size unallocated_space
----------------------------------------------------------
<database 2 name> <value> <value>

database_name database_size unallocated_space
----------------------------------------------------------
<database 3 name> <value> <value>

I am looking for it in the following output:

database_name database_size unallocated_space
----------------------------------------------------------
<database 1 name> <value> <value>
<database 2 name> <value> <value>
<database 3 name> <value> <value>

I tried to output the results of the sp_spaceused (using the curosr variable) into a temporary table to list the results properly, but the query will not allow a ' select @variable <SQL Statement>' with an insert into temp table command!!!

View 2 Replies


ADVERTISEMENT

Challenge : Vertical View To Horizontal In A StorProc

Jul 9, 2004

From:
Cust | Qstion | Answer
_________________________________
1,1,Bike
1,4,Blue
1,6,No ensurance
2,1,Car
2,3,silver
2,9,ensurance
2,11,Yes


To the following
Cust______1______3______4______6______9______11
__________________________________________________ __________
1_______Bike___________Blue__No ENsur_________
2_______car____silver_________________Ens____Yes"

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved