Size of VARBINARY field in SQL Server 2005

前端 未结 2 1985
醉酒成梦
醉酒成梦 2020-12-05 06:30

I am trying to determine the size in bytes of the contents in a VARBINARY(MAX) field in SQL Server 2005, using SQL. As I doubt there is native support for this,

相关标签:
2条回答
  • 2020-12-05 06:44

    Actually, you can do this in T-SQL!

    DATALENGTH(<fieldname>) will work on varbinary(max) fields.

    0 讨论(0)
  • 2020-12-05 06:54

    The VARBINARY(MAX) field allocates variable length data up to just under 2GB in size.

    You can use DATALENGTH() function to determine the length of the column content.

    For example:

    SELECT DATALENGTH(CompanyName), CompanyName
    FROM Customers
    
    0 讨论(0)
提交回复
热议问题