home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 18,891 of 19,505   
   rja.carnegie@gmail.com to All   
   Re: Hi Experts i have doubt   
   21 May 13 07:16:34   
   
   On Tuesday, 21 May 2013 14:27:33 UTC+1, n  wrote:   
   > have MS SQL 2008 R2, 500 databases. What is the most efficient, easiest and   
   'modern' way to query all databases sizes.   
   >    
   > The output should have columns:   
   >    
   > •DatabaseName   
   >    
   > •DataFilesSize   
   >    
   > •LogFilesSize   
      
   I've only got SQL Server 2005; here, the system catalog view,   
   sys.master_files, has the information you're looking for.     
   You'll need DB_NAME([database_id]) for the first column, and,    
   to have the MDF/NDF and log file sizes side by side in a row,   
   you're going to need one of those "PIVOT" bits, I suppose.   
   I can never remember how to do that.  But it is "modern".  ;-)   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca