I have a table Table1
with large amounts of BLOB data in a column blob_column2
.
I want to calculate the maximum size of the blob (in KBs or MBs) stored in this column.
I need this input for migrating the data.
Can someone help with the query to calculate the maximum size of the blob?
The SQL Server database version is 2016 (v13.0).
1条答案
按热度按时间kg7wmglp1#
The question is badly worded and since no attempt is shown, one can only guess what's being asked
You may be asking how to find the larges (maximum) blob size. Finding the maximum is done with
MAX
:That's not very useful for migration, unless you migrate to a database where blobs have length restrictions like MySQL, where BLOB is just 65KB. The equivalent to
varchar(max)
isLONGBLOB
. There may be more issues from missing features like FILESTREAM storage.Or you may be asking for the total size of all BLOBs, which is useful in storage calculations:
You can calculate multiple statistics at once:
Keep in mind that everyone except storage vendors defines 1 KB=1024 bytes. That includes file system creators. Storage vendors define it as 1000 bytes