Hi All,
I wonder if you can help me, I'm trying to return some values using a connection from Excel to SQL Server.
The code I'm using is as follows:
This correctly returns each of the names, the filename and the "FileSizeMB" correctly, however, the "SpaceUsed" (Highlighted) isn't working.
I've tested it in SQL Management studio and it works correctly and I've stripped it down to the bear essentials and it still doesn't work.
Anyone got any ideas why this would be the case and how I can get it to work??
Thanks all
Fitz
Fitz
Did you know, there are 10 types of people in this world:
* Those who understand binary
and
* Those who Don't!!
I wonder if you can help me, I'm trying to return some values using a connection from Excel to SQL Server.
The code I'm using is as follows:
Code:
select name, filename, convert(decimal(12,2),round(a.size/128.000,2)) as FileSizeMB
, [COLOR=#EF2929][b]convert(decimal(12,2),round(fileproperty(a.name,''SpaceUsed'')/128.000,2))[/b][/color] as SpaceUsedMB
from myDB.dbo.sysfiles a
This correctly returns each of the names, the filename and the "FileSizeMB" correctly, however, the "SpaceUsed" (Highlighted) isn't working.
I've tested it in SQL Management studio and it works correctly and I've stripped it down to the bear essentials and it still doesn't work.
Code:
select name, fileproperty(a.name,''SpaceUsed'') as SpaceUsedMB
from myDB.dbo.sysfiles a
Anyone got any ideas why this would be the case and how I can get it to work??
Thanks all
Fitz
Fitz
Did you know, there are 10 types of people in this world:
* Those who understand binary
and
* Those who Don't!!