How to get size of file uploaded to SQL-Server?
Is there a way to tell how to get a file size that is uploaded to database?
SELECT [ID]
,[File]
FROM [dbo].[Reports]
I would like to be able to tell user the size 开发者_JAVA百科of File which is VarBinary(max)
field in MS SQL 2005/2008. How to do that?
Maybe the only way to do is to create another column and when inserting file i should also insert it's size in additional column?
You can use the datalength
function:
select ID, File, Length = datalength(File)
from dbo.Reports
Use the DATALENGTH() function to retrieve the size of a VARBINARY
精彩评论