You can insert varbinary(max) into the field using T-SQL using the OPENROWSET OPENROWSET .
INSERT dbo.tblPhotos ( LargePhoto ) SELECT tblPhotos.* FROM OPENROWSET (BULK 'c:\images\image*.jpg', SINGLE_BLOB) ThumbnailPhoto
Please note that the file path in this case refers to the target SQL server and not to your client executing this command.
Essentially, there are two ways to CHOOSE BLOB with TSQL:
SELECT * FROM OPENROWSET (BULK 'C:\Test\Test1.pdf', SINGLE_BLOB) a
As well as:
SELECT BulkColumn FROM OPENROWSET (BULK 'C:\Test\Test1.pdf', SINGLE_BLOB) a
Then you can use it for INSERT by doing INSERT SELECT ... or UPDATE SELECT ...
More details here.
source share