Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Tuesday, May 30, 2017 7:50 PM
Hello,
Goal is to insert an image file into a table as a VARBINARY(max) data type without having to first cobble together a C# project to support doing this.
Any help is appreciated.
K
Tuesday, May 30, 2017 8:02 PM ✅Answered
Try this:
declare @varbinary_max varbinary(max)
SELECT @varbinary_max =BulkColumn
FROM OPENROWSET (BULK 'C:\inetpub\wwwroot\welcome.png', SINGLE_BLOB) MyFile
select @varbinary_max , convert(varchar(max), @varbinary_max)
Note when I convert the stream to varchar(max) I see the string png.
Tuesday, May 30, 2017 8:05 PM
Thanks Hilary