Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select only part of BLOB column

Tags:

sqlite

How can I select only 1kb from a BLOB field, in a SQLite Database?

I imagine it to be something like this

SELECT PART(`field_name`, startIndex, bytes) AS data FROM `table` ....

Is this possible?

like image 251
Krimson Avatar asked Nov 16 '25 09:11

Krimson


1 Answers

Use substr():

The substr(X,Y,Z) function returns a substring of input string X that begins with the Y-th character and which is Z characters long. If X is a BLOB then the indices refer to bytes.

like image 135
CL. Avatar answered Nov 18 '25 12:11

CL.