How to insert image file as blob data (varbinary(max))
MS SQL
MS SQL
[sql]insert TEMP_UPLOAD_IMAGE (UploadInspectionId, FileName, Data) values (1002666, ‘IMG_20180823_061350847.jpg’, (SELECT BulkColumn FROM OPENROWSET(BULK N’D:\_temp_\IMG_20180823_061350847.jpg’, SINGLE_BLOB) AS SRC))[/sql]
How to convert blob data (varbinary) to base64?
MS SQL
[sql]select ImageField, base64
from IMAGE_TABLE
cross apply (select ImageField as ‘*’ for xml path(”)) T (baze64)
where id_field = 1810[/sql]
Leave a Reply