Performing BULK operations with SQL can be useful when you are trying to insert any type of file. Don't mess up with the complex code, just use a simple SQL query to insert any file type in SQL table.
To perform this operation first you need to have a column with datatype as varbinary(max). See below example:
Create a table with an ID and Data as columns with INT and VARBINARY(MAX) as their Datatypes respectively.
Create table tblData ( FileId int, FileData varbinary(max) )
Perform INSERT to Save a file. Here just change the location of the file you want to insert
Insert into tblData (FileId, FileData) SELECT 1, BulkColumn FROM OPENROWSET(BULK N'D:\Software\siw.exe', SINGLE_BLOB) AS Document
Display table data after INSERT
Select * from tblData