Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Get total size of current sql server database

Get total size of current sql server database

Scheduled Pinned Locked Moved Database
databasecsharpsql-serversysadminquestion
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    theanton
    wrote on last edited by
    #1

    Is there a function in MS SQL server to get the total size of the current database (or a single table) in KBs? It's possible to get this information through Enterprise Manager but I would like to get it through C# code.

    P 1 Reply Last reply
    0
    • T theanton

      Is there a function in MS SQL server to get the total size of the current database (or a single table) in KBs? It's possible to get this information through Enterprise Manager but I would like to get it through C# code.

      P Offline
      P Offline
      Paul Conrad
      wrote on last edited by
      #2

      You may want to investigate the stored procedure called sys.sp_databases It returns all of the databases that are online, along with their size, and any remarks about the database. I hope this is a starting point for you :) Paul

      T J 2 Replies Last reply
      0
      • P Paul Conrad

        You may want to investigate the stored procedure called sys.sp_databases It returns all of the databases that are online, along with their size, and any remarks about the database. I hope this is a starting point for you :) Paul

        T Offline
        T Offline
        theanton
        wrote on last edited by
        #3

        Thank you very much. This is exactly what I needed!

        P 1 Reply Last reply
        0
        • T theanton

          Thank you very much. This is exactly what I needed!

          P Offline
          P Offline
          Paul Conrad
          wrote on last edited by
          #4

          You're very welcome :)

          1 Reply Last reply
          0
          • P Paul Conrad

            You may want to investigate the stored procedure called sys.sp_databases It returns all of the databases that are online, along with their size, and any remarks about the database. I hope this is a starting point for you :) Paul

            J Offline
            J Offline
            japel
            wrote on last edited by
            #5

            Hello I would like to know more on how you call Stored Procedures to fill a datagrid? Very new to the SQL / Dev world but would like to try the sys.sp_databases mentioned in this thread. If there is am example that would be great. Thanks.. When people make you see red, be thankful your not colour blind.

            C 1 Reply Last reply
            0
            • J japel

              Hello I would like to know more on how you call Stored Procedures to fill a datagrid? Very new to the SQL / Dev world but would like to try the sys.sp_databases mentioned in this thread. If there is am example that would be great. Thanks.. When people make you see red, be thankful your not colour blind.

              C Offline
              C Offline
              Colin Angus Mackay
              wrote on last edited by
              #6

              This is off topic for this thread - You may wish to start your own thread to start a new topic. ColinMackay.net Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?

              J 1 Reply Last reply
              0
              • C Colin Angus Mackay

                This is off topic for this thread - You may wish to start your own thread to start a new topic. ColinMackay.net Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?

                J Offline
                J Offline
                japel
                wrote on last edited by
                #7

                I was relating it to your original reply regarding sys.sp_databases... But your point it well taken... Thanks for the fast response... When people make you see red, be thankful your not colour blind.

                P 1 Reply Last reply
                0
                • J japel

                  I was relating it to your original reply regarding sys.sp_databases... But your point it well taken... Thanks for the fast response... When people make you see red, be thankful your not colour blind.

                  P Offline
                  P Offline
                  Paul Conrad
                  wrote on last edited by
                  #8

                  You can fill a datagrid with a stored procedure like the one I mentioned to theaton. Instead of using an SQL query, you'd use the stored procedure and instead of commandType being query, you'd specify that you are calling a stored procedure. I hope this helps some, Paul

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups