In case anyone finds it useful.  This code updates a table with the db sizes
of all db's on the server.

Thanks for your help putting this together :-)

<CFLOCK Name="ServiceFactory" Type="Exclusive" TimeOut="10">
<CFSET Factory = CreateObject("java", "coldfusion.server.ServiceFactory")>
<CFSET Service = Factory.getDataSourceService()>  <CFSET DataSources =
Service.DataSources>
<CFSET Datasources = StructKeyArray(Datasources)>
<CFSET Temp = ArraySort(Datasources, "textnocase", "asc")>
</CFLOCK>
<select name="datasource">
<CFOUTPUT>
<CFLOOP From="1" To="#ArrayLen(Datasources)#" Index="i">   <option
value="#Datasources[i]#">#Datasources[i]#</option>
</CFLOOP>
</CFOUTPUT> </select>

<CFLOOP From="1" To="#ArrayLen(Datasources)#" Index="i">
<cfstoredproc procedure="sp_helpdb" datasource="#application.dsn#">
    <cfprocparam
    cfsqltype="CF_SQL_VARCHAR" dbvarname="Name" type="In"
value="#Datasources[i]#">
    <cfprocresult name="MyResult">
</cfstoredproc>
<cfoutput query="MyResult">
<cfset DBsize2 = #val(listgetat(Myresult.DB_Size, 1, " "))#>
        <Cfquery datasource="#application.dsn#">
        update tbl_sites
        set DBsize = #dbsize2#
        where DBname = '#Datasources[i]#'
        </Cfquery>
</cfoutput>
<cfoutput>
</cfoutput>
</CFLOOP>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301893
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to