Home > Archive > MS SQL Server > October 2006 > Free space in a filegroup.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Free space in a filegroup.
Sezgin Rafet

2006-10-24, 6:33 pm

Hi everyone,

I need to write a SP to check the available free space in a certain database
filegroup(SQL Server 2000 database).

Any help will be appreciated.


Best Regards,




John Bell

2006-10-24, 6:33 pm

Hi

You may want to look at http://sqlteam.com/item.asp?ItemID=282 on
calculating sizes of tables. If you need filegroups, then sysindexes contains
a groupid column that you can link back to the filegroup.

John

"Sezgin Rafet" wrote:

> Hi everyone,
>
> I need to write a SP to check the available free space in a certain database
> filegroup(SQL Server 2000 database).
>
> Any help will be appreciated.
>
>
> Best Regards,
>
>
>
>
>

Sezgin Rafet

2006-10-24, 6:33 pm

Thanks,it is a very useful SP. Meanwhile, I spent some time reading Books
Online and came up with this solution:

SELECT ([size]*8)/1024.0 AS CurrentSizeInMB,(CAS
T(FILEPROPERTY('file
name',
'SpaceUsed') AS INTEGER )*8)/1024.0 AS SpaceUsedInMB FROM sysfiles WHERE
[name] = 'filename'

We use 2 filegroups containing 1 file each,so this will do for now.

Regards,


"John Bell" < jbellnewsposts@hotma
il.com> wrote in message
news:E7BD935E-0D06-4546-8D1E- 6AA3FD39C136@microso
ft.com...[color=darkred]
> Hi
>
> You may want to look at http://sqlteam.com/item.asp?ItemID=282 on
> calculating sizes of tables. If you need filegroups, then sysindexes
> contains
> a groupid column that you can link back to the filegroup.
>
> John
>
> "Sezgin Rafet" wrote:
>


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com