How to find the no. of hard-disk present in the computer by simple java prg

Hi All !!!
I want to find no. of hard-disk present in my computer by JAVA program.so if someone has already done this,plz tell me the Class and method by which i could do this.
Thanks and Regards
Allwyn

I don't think it's possible using the standard java API - ie you will need
some native code to help.
But File does offer listRoots(). On a Windows machine this will (often)
return "drives" (letters associated with local disk partitions, or mapped
to network resources). This may be enough for what you want.
File is here: http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html

Similar Messages

  • How to find the Latency time in java.

    How to find the Latency time in java.

    long start = System.currentTimeMillis();
    doTheWork();
    long durationInMillis = System.currentTimeMillis() - start;You might repeat doTheWork() several (100-1000 or more) times if it is fast and the granularity of your system clock is not good enough.

  • How to find the  System Dbtype in java code

    How to find the System Dbtype in java code
    I need various Db connection my project (oracle, sq l,sybase,db2),So How to find the System Dbtype in java code

    Welcome to the Forums.
    Please go through the FAQ of the Forum.
    You has posted your query in the wrong Forum, this one is dedicated to Oracle Forms.
    Please try {forum:id=1050}.
    Regards,

  • Windows Server 2008 R2 File in Use - How to find the computer that has it in use

    Lately we've been having an access database go into read only mode on our file server. When i go into the manage open files screen on the file server, it show the file being used by a functional account and the open mode is set to read. Which confuses
    me how the file can get set in read only mode when the only person who has it open has it open in read mode. Anyway, when i kick the user out of the file then the database is not read only mode anymore.  Since this is getting accessed by a functional
    account, I'm not sure who is opening it up. Is there a way to find the IP address of this person?

    To get the source IP address, you will need to enable File Share auditing: http://technet.microsoft.com/en-us/library/dd772690%28v=ws.10%29.aspx
    Otherwise, you can simply disconnect the user session.
    This posting is provided AS IS with no warranties or guarantees , and confers no rights.
    Ahmed MALEK
    My Website Link
    My Linkedin Profile
    My MVP Profile

  • How to update the file in simple java archive file on Netweaver2004s

    We have a J2EE application containing few properties file packed inside a java archive. These properties are Configuration properties which we are required to change few times after deployment.We are using SAP Visual Administrator to deploy\undeploy our application.We found out that Visual Administrator dose not support update of files packed in a simple Java Archive in Single File Update Option. It only allows updates of EJB Modules archive.
    Please let us know if there is any other way we can update a file inside a simple java archive.

    Well, Thanks for the help but,. i didn't understand
    try not opening the file every time. As I only know that I need to open a file if i would like to update the records..
    The update is not happening :
    Firstly it shows like this (new.txt):
    STOPSecondly it must show like this (new.txt) BUT NOT HAPPENING AS I EXPECTED:
    STOPSTOPBut it's not hapenning

  • How to find the Execution Time for Java Code?

    * Hi everyone , i want to calculate the execution time for my process in java
    * The following was the ouput for my coding,
    O/P:-
    This run took 0 Hours ;1.31 Minutes ;78.36 Seconds
    *** In the above output , the output should come exactly what hours , minutes and seconds for my process,
    but in my code the minutes are converted into seconds(It should not)...
    * Here is my coding,
        static long start_time;
        public static void startTime()
            start_time = System.currentTimeMillis();
        public static void endTime()
            DecimalFormat df = new DecimalFormat("##.##");
            long end_time = System.currentTimeMillis();
            float t = end_time - start_time;
            float sec = t / 1000;
            float min = 0, hr = 0;
            if (sec > 60) {
                min = sec / 60;
            if (min > 60) {
                hr = min / 60;
            System.out.println("This run took " + df.format(hr) + " Hours ;"+ df.format(min) + " Minutes ;" + df.format(sec) + " Seconds");
        }* How to Calcualte exact timing for my process....
    * Thanks

    * Hi flounder, Is following code will wotk perfectly?
         public static void endTime()
              DecimalFormat df = new DecimalFormat("##.##");
              long end_time = System.currentTimeMillis();
              float t = end_time - start_time;
              float sec = t / 1000;
              float min = 0, hr = 0;
              while(sec >= 60){
         min++;
         sec = sec -60;
         if (min >= 60){
         min = 0; //or min = min -60;
         hr++;
              System.out.println("This run took " + df.format(hr) + " Hours ;"+ df.format(min) + " Minutes ;" + df.format(sec) + " Seconds");
         }

  • How to find the version number of Java compiler used

    Is there a simple programatical way to extract what version of Java compiler was used to create a certain class file (the byte code) from within the program?
    Actually, by checking the file is ok too.

    Thanks for the program. I've run it and I got 1.4.2as
    an output.
    Can I assume I'me using SDK 1.4.2 through netBeansIDE
    3.5.1 (which it came with bundled)?if you would remove J2SDK 1.4.0, then you could be
    sure that your netbeans is NOT using it anymore...
    howevere, you could also set some settings inside
    netbean, and voila... you could set it to use
    whichever sdk version you want...
    but if you are not sure which one of these it
    currently uses, then i assume that it is sdk 1.4.0,
    because i have no reason to believe othervise.This is from my old AUTOEXEC.BAT:
    SET CLASSPATH=.
    SET PATH=C:\j2sdk1.4.0_01\bin
    I installed netBeans IDE 3.5.1 a few weeks ago, but did not change my AUTOEXEC.BAT file for a while.
    Then I changed AUTOEXEC file to the following:
    SET CLASSPATH=.
    SET PATH=C:\Program Files\j2sdk_nb\j2sdk1.4.2\bin
    IDE kept working, but DOS stopped recognizing javac command.
    After getting suggestions from some people here, I changed the AUTOEXEC to:
    SET CLASSPATH=.
    SET PATH=C:\Progra~1\j2sdk_nb\j2sdk1.4.2\bin
    IDE still works, and I can compile from DOS now.
    SDK 1.4.2 must have been installed (or at least unpacked) by IDE 3.5.1.
    Does anybody know how to change settings on IDE 3.5.1 to make it use whichever SDK I want to try?

  • On my macbook pro the hard drive icon is not on my desktop and I don't know how to find the hard drive or get the icon back on my desktop

    on my macbook pro the hard drive icon is not on my desktop and I don't know how to find the hard drive or get the icon back on my desktop

    Click on the Desktop. From the Finder menu select Preferences. Check the boxes for what you want on your Desktop. If they are already checked, then try unchecking and rechecking.

  • How to find the amount of free disk space on my pc....... in java of course

    how to find the amount of free disk space on my pc

    http://onesearch.sun.com/search/onesearch/index.jsp?qt=free+disk+space&subCat=siteforumid%3Ajava31&site=dev&dftab=siteforumid%3Ajava31&chooseCat=javaall&col=developer-forums

  • Setup did not find any hard disks installed in your computer

    OK, I spent about 30 minutes looking for a solution to this and haven't found anything. I'm too lazy to keep looking, and I need to get back to work...
    Setup info:
    -Mac Pro (Early 2008)
    -Dual 3.2Ghz processors
    -32GB RAM
    -RAID Card with four 1TB drives attached (RAID 5 with two volumes: one Mac OS X 10.5.3 and one Mac OS X Server 10.5.3)
    -320GB SATA drive that originally came with the unit in hard drive bay 1, now installed in the 2nd optical drive bay and connected to the 5th internal SATA port. It's partitioned with BootCamp: 32.88GB for Mac OS X 10.5.3 (installed and running, used to create the BootCamp partition) and 264.71GB available for Windows.
    Windows install disc:
    Took my Windows XP SP1 install disc and used nLite to slipstream SP2 and SP3 and burn a new install disc.
    When I boot into the Windows install disc, everything goes fine, until it actually gets to the part where I should be selecting my hard drive (Hit Enter to Install Windows) for installation. Instead , when I hit enter, I get the message that "+Setup did not find any hard disks installed in your computer. blah, blah, blah, hit F3 to restart.+"
    I'm assuming this is a SATA issue and that I need to get a SATA driver slipstreamed into my install disc so that the Windows installer will see the SATA drive.
    Any suggestions on how to proceed?

    Everything I've read says that that won't work because I have the RAID card.
    Sounds like I'm out of luck, if BootCamp can't be installed on a SATA drive not connected to one of the original 4 bays.
    Also, I'm concerned about taking the RAID drives out (I'd have to take all 4 out or it corrupts the RAID setup when I stick the one back in) then putting them back in and having everything return to an All Good status.
    Message was edited by: chadcole26

  • How to find the number of references created for a given  object ??

    How to find the number of references created for a given object in a big application environment.
    That means, if i give any object name (of my application) as input, then how can i find the[b] number of references created for that particular object ??

    Please do not post the same question multiple times.
    As for your original question, there is no direct way to do it.
    Especially not the way you phrased it,
    since objects don't have "names".
    Applications also don't have "names".
    They have classes and instances.
    Also, there are 2 related issues, and I'm not sure which one is the one you asked.
    #1. Finding the number of references to the same object.
    Eg.
    Map<String,String> a = new HashMap<String,String>();
    Map<String,String> b = new HashMap<String,String>();
    Map<String,String> c = a;In this case, there are only 2 objects.
    The first object has (at least) 2 references pointing to it.
    The second object has (at least) 1 reference pointing to it.
    (There may be more, if the HashMap library keeps
    references to these things, or if the HashMap object has
    some internal cyclic references...)
    If you're asking this, then it can't be done.
    It's an active research topic in universities
    and software research labs, called "alias analysis".
    Type it in google, and you'll see people are working hard
    and having little success so far.
    #2. Finding the number of instances created from a class.
    In this case, what you have to do is to add a counter to
    the constructor of the class. Every time an object is constructed,
    you increment the counter. Like this:
       class MyClass
           public static int counter = 0;
           public MyClass( )  { counter++; }
        // Then later in your program, you can do this:
        MyClass a = new MyClass();
        MyClass b = new MyClass();
        System.out.println(MyClass.counter); // It should show 2Note: you won't be able to do this to every class in the system.
    For every class you care about, you have to modify its constructor.
    Also: when an object is deleted, you won't always know it
    (and thus you won't always be able to decrement the counter).
    Finalizers cannot always work (read Joshua Bloch's
    "Effective Java" book if you don't believe me), but basically
    (1) finalizers will not always be called, and
    (2) finalizers can sometimes cause objects to not be deleted,
    and thus the JVM will run out of memory and crash

  • Setup did not find any hard disk drive in your computer

    I have an old Compaq Presario 7598 Desktop (Windows XP) which I use as a backup machine. Recently when I tried to start it I am getting "Unable to access hard disk,. Operating system not found on any devices". Then when I tried to start with XP Boot Disk (CD), I am getting "Setup did not find any hard disk drive in your computer".
    Can someone help me to resolve this issue?
    Thanks.

    Repeatedly tap the F10 key at boot, you should see information for the hard disk.
    Testing the hard drive:
    http://h20564.www2.hp.com/hpsc/doc/public/display?​docId=emr_na-bph05701#N100A0
    Please mark my post as SOLVED if it has resolved your problem. It helps others with similar situations.

  • How to find the database growth rate?

    Wanted to do the forecasting of disk growth for one year. How to find the database growth rate?
    Rahul

    This is code authored by Richard Ding that will log database sizes to a table.  If you run it every day, then you can go back and compare the database size differences day to day... week to week... month to month... and year over year.  That is
    how I forecast growth over time.
    Note:  There is a database name required that is local to your environment, so change [YOURDATABASENAME] to whatever local database you wish to use.  I will also post the DDL to create the target table.  Create that table in the database you
    name in the stored procedure code and all should run fine.
    USE [master]
    GO
    /****** Object: StoredProcedure [dbo].[sp_SDS] Script Date: 04/22/2015 09:32:53 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[sp_SDS]
    @TargetDatabase sysname = NULL, -- NULL: all dbs
    @Level varchar(10) = 'Database', -- or "File"
    @UpdateUsage bit = 0, -- default no update
    @Unit char(2) = 'MB' -- Megabytes, Kilobytes or Gigabytes
    AS
    ** author: Richard Ding
    ** date: 4/8/2008
    ** usage: list db size AND path w/o SUMmary
    ** test code: sp_SDS -- default behavior
    ** sp_SDS 'maAster'
    ** sp_SDS NULL, NULL, 0
    ** sp_SDS NULL, 'file', 1, 'GB'
    ** sp_SDS 'Test_snapshot', 'Database', 1
    ** sp_SDS 'Test', 'File', 0, 'kb'
    ** sp_SDS 'pfaids', 'Database', 0, 'gb'
    ** sp_SDS 'tempdb', NULL, 1, 'kb'
    SET NOCOUNT ON;
    IF @TargetDatabase IS NOT NULL AND DB_ID(@TargetDatabase) IS NULL
    BEGIN
    RAISERROR(15010, -1, -1, @TargetDatabase);
    RETURN (-1)
    END
    IF OBJECT_ID('tempdb.dbo.##Tbl_CombinedInfo', 'U') IS NOT NULL
    DROP TABLE dbo.##Tbl_CombinedInfo;
    IF OBJECT_ID('tempdb.dbo.##Tbl_DbFileStats', 'U') IS NOT NULL
    DROP TABLE dbo.##Tbl_DbFileStats;
    IF OBJECT_ID('tempdb.dbo.##Tbl_ValidDbs', 'U') IS NOT NULL
    DROP TABLE dbo.##Tbl_ValidDbs;
    IF OBJECT_ID('tempdb.dbo.##Tbl_Logs', 'U') IS NOT NULL
    DROP TABLE dbo.##Tbl_Logs;
    CREATE TABLE dbo.##Tbl_CombinedInfo (
    DatabaseName sysname NULL,
    [type] VARCHAR(10) NULL,
    LogicalName sysname NULL,
    T dec(10, 2) NULL,
    U dec(10, 2) NULL,
    [U(%)] dec(5, 2) NULL,
    F dec(10, 2) NULL,
    [F(%)] dec(5, 2) NULL,
    PhysicalName sysname NULL );
    CREATE TABLE dbo.##Tbl_DbFileStats (
    Id int identity,
    DatabaseName sysname NULL,
    FileId int NULL,
    FileGroup int NULL,
    TotalExtents bigint NULL,
    UsedExtents bigint NULL,
    Name sysname NULL,
    FileName varchar(255) NULL );
    CREATE TABLE dbo.##Tbl_ValidDbs (
    Id int identity,
    Dbname sysname NULL );
    CREATE TABLE dbo.##Tbl_Logs (
    DatabaseName sysname NULL,
    LogSize dec (10, 2) NULL,
    LogSpaceUsedPercent dec (5, 2) NULL,
    Status int NULL );
    DECLARE @Ver varchar(10),
    @DatabaseName sysname,
    @Ident_last int,
    @String varchar(2000),
    @BaseString varchar(2000);
    SELECT @DatabaseName = '',
    @Ident_last = 0,
    @String = '',
    @Ver = CASE WHEN @@VERSION LIKE '%9.0%' THEN 'SQL 2005'
    WHEN @@VERSION LIKE '%8.0%' THEN 'SQL 2000'
    WHEN @@VERSION LIKE '%10.0%' THEN 'SQL 2008'
    WHEN @@VERSION LIKE '%11.0%' THEN 'SQL 2012'
    WHEN @@VERSION LIKE '%12.0%' THEN 'SQL 2014'
    END;
    SELECT @BaseString =
    ' SELECT DB_NAME(), ' +
    CASE WHEN @Ver = 'SQL 2000' THEN 'CASE WHEN status & 0x40 = 0x40 THEN ''Log'' ELSE ''Data'' END'
    ELSE ' CASE type WHEN 0 THEN ''Data'' WHEN 1 THEN ''Log'' WHEN 4 THEN ''Full-text'' ELSE ''reserved'' END' END +
    ', name, ' +
    CASE WHEN @Ver = 'SQL 2000' THEN 'filename' ELSE 'physical_name' END +
    ', size*8.0/1024.0 FROM ' +
    CASE WHEN @Ver = 'SQL 2000' THEN 'sysfiles' ELSE 'sys.database_files' END +
    ' WHERE '
    + CASE WHEN @Ver = 'SQL 2000' THEN ' HAS_DBACCESS(DB_NAME()) = 1' ELSE 'state_desc = ''ONLINE''' END + '';
    SELECT @String = 'INSERT INTO dbo.##Tbl_ValidDbs SELECT name FROM ' +
    CASE WHEN @Ver = 'SQL 2000' THEN 'master.dbo.sysdatabases'
    WHEN @Ver IN ('SQL 2005', 'SQL 2008', 'SQL 2012', 'SQL 2014') THEN 'master.sys.databases'
    END + ' WHERE HAS_DBACCESS(name) = 1 ORDER BY name ASC';
    EXEC (@String);
    INSERT INTO dbo.##Tbl_Logs EXEC ('DBCC SQLPERF (LOGSPACE) WITH NO_INFOMSGS');
    -- For data part
    IF @TargetDatabase IS NOT NULL
    BEGIN
    SELECT @DatabaseName = @TargetDatabase;
    IF @UpdateUsage <> 0 AND DATABASEPROPERTYEX (@DatabaseName,'Status') = 'ONLINE'
    AND DATABASEPROPERTYEX (@DatabaseName, 'Updateability') <> 'READ_ONLY'
    BEGIN
    SELECT @String = 'USE [' + @DatabaseName + '] DBCC UPDATEUSAGE (0)';
    PRINT '*** ' + @String + ' *** ';
    EXEC (@String);
    PRINT '';
    END
    SELECT @String = 'INSERT INTO dbo.##Tbl_CombinedInfo (DatabaseName, type, LogicalName, PhysicalName, T) ' + @BaseString;
    INSERT INTO dbo.##Tbl_DbFileStats (FileId, FileGroup, TotalExtents, UsedExtents, Name, FileName)
    EXEC ('USE [' + @DatabaseName + '] DBCC SHOWFILESTATS WITH NO_INFOMSGS');
    EXEC ('USE [' + @DatabaseName + '] ' + @String);
    UPDATE dbo.##Tbl_DbFileStats SET DatabaseName = @DatabaseName;
    END
    ELSE
    BEGIN
    WHILE 1 = 1
    BEGIN
    SELECT TOP 1 @DatabaseName = Dbname FROM dbo.##Tbl_ValidDbs WHERE Dbname > @DatabaseName ORDER BY Dbname ASC;
    IF @@ROWCOUNT = 0
    BREAK;
    IF @UpdateUsage <> 0 AND DATABASEPROPERTYEX (@DatabaseName, 'Status') = 'ONLINE'
    AND DATABASEPROPERTYEX (@DatabaseName, 'Updateability') <> 'READ_ONLY'
    BEGIN
    SELECT @String = 'DBCC UPDATEUSAGE (''' + @DatabaseName + ''') ';
    PRINT '*** ' + @String + '*** ';
    EXEC (@String);
    PRINT '';
    END
    SELECT @Ident_last = ISNULL(MAX(Id), 0) FROM dbo.##Tbl_DbFileStats;
    SELECT @String = 'INSERT INTO dbo.##Tbl_CombinedInfo (DatabaseName, type, LogicalName, PhysicalName, T) ' + @BaseString;
    EXEC ('USE [' + @DatabaseName + '] ' + @String);
    INSERT INTO dbo.##Tbl_DbFileStats (FileId, FileGroup, TotalExtents, UsedExtents, Name, FileName)
    EXEC ('USE [' + @DatabaseName + '] DBCC SHOWFILESTATS WITH NO_INFOMSGS');
    UPDATE dbo.##Tbl_DbFileStats SET DatabaseName = @DatabaseName WHERE Id BETWEEN @Ident_last + 1 AND @@IDENTITY;
    END
    END
    -- set used size for data files, do not change total obtained from sys.database_files as it has for log files
    UPDATE dbo.##Tbl_CombinedInfo
    SET U = s.UsedExtents*8*8/1024.0
    FROM dbo.##Tbl_CombinedInfo t JOIN dbo.##Tbl_DbFileStats s
    ON t.LogicalName = s.Name AND s.DatabaseName = t.DatabaseName;
    -- set used size and % values for log files:
    UPDATE dbo.##Tbl_CombinedInfo
    SET [U(%)] = LogSpaceUsedPercent,
    U = T * LogSpaceUsedPercent/100.0
    FROM dbo.##Tbl_CombinedInfo t JOIN dbo.##Tbl_Logs l
    ON l.DatabaseName = t.DatabaseName
    WHERE t.type = 'Log';
    UPDATE dbo.##Tbl_CombinedInfo SET F = T - U, [U(%)] = U*100.0/T;
    UPDATE dbo.##Tbl_CombinedInfo SET [F(%)] = F*100.0/T;
    IF UPPER(ISNULL(@Level, 'DATABASE')) = 'FILE'
    BEGIN
    IF @Unit = 'KB'
    UPDATE dbo.##Tbl_CombinedInfo
    SET T = T * 1024, U = U * 1024, F = F * 1024;
    IF @Unit = 'GB'
    UPDATE dbo.##Tbl_CombinedInfo
    SET T = T / 1024, U = U / 1024, F = F / 1024;
    SELECT DatabaseName AS 'Database',
    type AS 'Type',
    LogicalName,
    T AS 'Total',
    U AS 'Used',
    [U(%)] AS 'Used (%)',
    F AS 'Free',
    [F(%)] AS 'Free (%)',
    PhysicalName
    FROM dbo.##Tbl_CombinedInfo
    WHERE DatabaseName LIKE ISNULL(@TargetDatabase, '%')
    ORDER BY DatabaseName ASC, type ASC;
    SELECT CASE WHEN @Unit = 'GB' THEN 'GB' WHEN @Unit = 'KB' THEN 'KB' ELSE 'MB' END AS 'SUM',
    SUM (T) AS 'TOTAL', SUM (U) AS 'USED', SUM (F) AS 'FREE' FROM dbo.##Tbl_CombinedInfo;
    END
    IF UPPER(ISNULL(@Level, 'DATABASE')) = 'DATABASE'
    BEGIN
    DECLARE @Tbl_Final TABLE (
    DatabaseName sysname NULL,
    TOTAL dec (10, 2),
    [=] char(1),
    used dec (10, 2),
    [used (%)] dec (5, 2),
    [+] char(1),
    free dec (10, 2),
    [free (%)] dec (5, 2),
    [==] char(2),
    Data dec (10, 2),
    Data_Used dec (10, 2),
    [Data_Used (%)] dec (5, 2),
    Data_Free dec (10, 2),
    [Data_Free (%)] dec (5, 2),
    [++] char(2),
    Log dec (10, 2),
    Log_Used dec (10, 2),
    [Log_Used (%)] dec (5, 2),
    Log_Free dec (10, 2),
    [Log_Free (%)] dec (5, 2) );
    INSERT INTO @Tbl_Final
    SELECT x.DatabaseName,
    x.Data + y.Log AS 'TOTAL',
    '=' AS '=',
    x.Data_Used + y.Log_Used AS 'U',
    (x.Data_Used + y.Log_Used)*100.0 / (x.Data + y.Log) AS 'U(%)',
    '+' AS '+',
    x.Data_Free + y.Log_Free AS 'F',
    (x.Data_Free + y.Log_Free)*100.0 / (x.Data + y.Log) AS 'F(%)',
    '==' AS '==',
    x.Data,
    x.Data_Used,
    x.Data_Used*100/x.Data AS 'D_U(%)',
    x.Data_Free,
    x.Data_Free*100/x.Data AS 'D_F(%)',
    '++' AS '++',
    y.Log,
    y.Log_Used,
    y.Log_Used*100/y.Log AS 'L_U(%)',
    y.Log_Free,
    y.Log_Free*100/y.Log AS 'L_F(%)'
    FROM
    ( SELECT d.DatabaseName,
    SUM(d.T) AS 'Data',
    SUM(d.U) AS 'Data_Used',
    SUM(d.F) AS 'Data_Free'
    FROM dbo.##Tbl_CombinedInfo d WHERE d.type = 'Data' GROUP BY d.DatabaseName ) AS x
    JOIN
    ( SELECT l.DatabaseName,
    SUM(l.T) AS 'Log',
    SUM(l.U) AS 'Log_Used',
    SUM(l.F) AS 'Log_Free'
    FROM dbo.##Tbl_CombinedInfo l WHERE l.type = 'Log' GROUP BY l.DatabaseName ) AS y
    ON x.DatabaseName = y.DatabaseName;
    IF @Unit = 'KB'
    UPDATE @Tbl_Final SET TOTAL = TOTAL * 1024,
    used = used * 1024,
    free = free * 1024,
    Data = Data * 1024,
    Data_Used = Data_Used * 1024,
    Data_Free = Data_Free * 1024,
    Log = Log * 1024,
    Log_Used = Log_Used * 1024,
    Log_Free = Log_Free * 1024;
    IF @Unit = 'GB'
    UPDATE @Tbl_Final SET TOTAL = TOTAL / 1024,
    used = used / 1024,
    free = free / 1024,
    Data = Data / 1024,
    Data_Used = Data_Used / 1024,
    Data_Free = Data_Free / 1024,
    Log = Log / 1024,
    Log_Used = Log_Used / 1024,
    Log_Free = Log_Free / 1024;
    DECLARE @GrantTotal dec(11, 2);
    SELECT @GrantTotal = SUM(TOTAL) FROM @Tbl_Final;
    INSERT INTO [YOURDATABASENAME].[dbo].[DBSize]
    ([Weight]
    ,[DBName]
    ,[Used]
    ,[Free]
    ,[Total]
    ,[Data]
    ,[Data_Used]
    ,[Log]
    ,[Log_Used]
    ,[DT])
    SELECT
    CONVERT(dec(10, 2), TOTAL*100.0/@GrantTotal) AS 'WEIGHT (%)',
    DatabaseName AS 'DATABASE',
    CONVERT(VARCHAR(12), used) AS 'USED',
    CONVERT(VARCHAR(12), free) AS 'FREE',
    TOTAL,
    CONVERT(VARCHAR(12), Data) AS 'DATA',
    CONVERT(VARCHAR(12), Data_Used) AS 'DATA_USED',
    CONVERT(VARCHAR(12), Log) AS 'LOG',
    CONVERT(VARCHAR(12), Log_Used) AS 'LOG_USED',
    GETDATE()
    FROM @Tbl_Final
    WHERE DatabaseName LIKE ISNULL(@TargetDatabase, '%')
    ORDER BY DatabaseName ASC;
    IF @TargetDatabase IS NULL
    SELECT CASE WHEN @Unit = 'GB' THEN 'GB' WHEN @Unit = 'KB' THEN 'KB' ELSE 'MB' END AS 'SUM',
    SUM (used) AS 'USED',
    SUM (free) AS 'FREE',
    SUM (TOTAL) AS 'TOTAL',
    SUM (Data) AS 'DATA',
    SUM (Log) AS 'LOG'
    FROM @Tbl_Final;
    END
    RETURN (0)
    GO
    USE [YOURDATABASENAME]
    GO
    /****** Object: Table [dbo].[DBSize] Script Date: 04/22/2015 09:49:10 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[DBSize](
    [UID] [int] IDENTITY(1,1) NOT NULL,
    [Weight] [decimal](18, 2) NULL,
    [DBName] [varchar](250) NULL,
    [Used] [decimal](18, 2) NULL,
    [Free] [decimal](18, 2) NULL,
    [Total] [decimal](18, 2) NULL,
    [Data] [decimal](18, 2) NULL,
    [Data_Used] [decimal](18, 2) NULL,
    [Log] [decimal](18, 2) NULL,
    [Log_Used] [decimal](18, 2) NULL,
    [DT] [datetime] NULL,
    CONSTRAINT [PK_DBSize] PRIMARY KEY CLUSTERED
    [UID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO

  • HT1175 How do you back up additional hard disks to time capsule? Which disks etc. to you choose?

    How do you back up additional hard disks to time capsule? Which disks etc. to you choose?

    I can read your question a number of ways.
    If you mean a disk plugged into your computer you wish to include in Time Machine backup.. just make sure it is HFS+ formatted and remove it from the exclusion list in the TM preferences.
    If you mean a disk plugged into your TC for backup,
    You can plug a USB disk into a Time Capsule as long as it is compatible.. and the disk is formatted HFS+, ie Mac OS extended Journaled.
    You need a USB powered hub if you want to use multiple hard disks and even one might still need a hub.
    Not all external drives are recogised but for example the Touro Deskpro works fine.
    You can buy them up to 4TB.. how much added space do you want.
    Also notice that USB 2 on a TC or AE is slow.. I mean half the speed of the same disk plugged into your computer so consider if speed is relevant to you.
    You cannot use TM to backup network disks.. again I am not 100% sure what the question means.

  • How to find the G/L Account

    Hi all
    How to find the G/L account based on the company code and tax code?Any tables to find that??

    Hi,
    Go to SE84 and then go the Dictionary Objects and in that Fields. Then give the Short Description or if you know the Field name give there and Execute.
    It is hard to find the Exact Table for example Material Number is available in more than 1000 tables
    Hope it is clear for you.
    Regards
    Ramchander Rao.K

Maybe you are looking for

  • User status profile in Q-info record not updating on UD

    Hi All, My required scenario was, delivery of a material from a vendor must pass through inspection series u2022     Model u2022     Preliminary   u2022     Regular delivery  For that, 1). Maintain different inspection types (with corresponding task

  • How do i get adobe to stop asking me to identify me comments

    how do i get adobe to stop asking me to identify my comment

  • Problem: program gives error when I run it

    When i run the program an input box pops up and the user types in onehalfday or onefullday depending on the number of the item and time period chosen by the user then the program is supposed to use system.out.println( ) to display the price of the it

  • New Printer to be attached

    hi i have a printer which has to be recognized by SAP. How to connect my new printer with my SAP server. Deepak

  • Need help with order cancellation

    Ordered Carbon ultrabook on last friday, I just called and also submitted the cancellation form online. Lenovo customer service sucks... keep telling me that they could not gurantee the cancellation since it's process! what process! The email I recei