X-Received: by 10.224.36.66 with SMTP id s2mr1580418qad.6.1369145795208; Tue, 21 May 2013 07:16:35 -0700 (PDT) X-Received: by 10.49.12.7 with SMTP id u7mr140244qeb.31.1369145795166; Tue, 21 May 2013 07:16:35 -0700 (PDT) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!209.85.216.88.MISMATCH!ch1no158692qab.0!news-out.google.com!y6ni50756qax.0!nntp.google.com!ch1no158690qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.databases.ms-sqlserver Date: Tue, 21 May 2013 07:16:34 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=194.83.173.135; posting-account=dELd-gkAAABehNzDMBP4sfQElk2tFztP NNTP-Posting-Host: 194.83.173.135 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <9fc73eac-be2f-4930-a035-a7d9dbfd2548@googlegroups.com> Subject: Re: Hi Experts i have doubt From: rja.carnegie@gmail.com Injection-Date: Tue, 21 May 2013 14:16:35 +0000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Xref: csiph.com comp.databases.ms-sqlserver:1488 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 a= nd 'modern' way to query all databases sizes. >=20 > The output should have columns: >=20 > =95DatabaseName >=20 > =95DataFilesSize >=20 > =95LogFilesSize I've only got SQL Server 2005; here, the system catalog view, sys.master_files, has the information you're looking for. =20 You'll need DB_NAME([database_id]) for the first column, and,=20 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". ;-)