Sunday, February 26, 2012

Free space in a filegroup.

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,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,
>
>
>|||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,(CAST(FILEPROPERTY('filename',
'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@.hotmail.com> wrote in message
news:E7BD935E-0D06-4546-8D1E-6AA3FD39C136@.microsoft.com...
> 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,
>>
>>

No comments:

Post a Comment