Length of varbinary(max) filestream on SQL Server 2008

TcKs picture TcKs · Apr 14, 2009 · Viewed 8.8k times · Source

Is there some efficient way how to get length of data in "varbinary(max) filestream" column? I found only samples with conversion to varchar and then calling the "LEN" function.

Answer

Jan Remunda picture Jan Remunda · May 12, 2009
SELECT
      length = DATALENGTH(Name),
      Name 
FROM 
      Production.Product 
ORDER BY 
      Name

"Returns the number of bytes used to represent any expression."

T-SQL and quote taken from MSDN's DATALENGTH (Transact-SQL) library.