How to insert a pdf or image to SQL server

706 Views Asked by At

I'm trying to add an img from my own computer for testing and I need to upload an img or pdf to a column in SQL Server as a varbinary data type. the table has 6 columns; description, img, date, etc.. how do I upload the img or pdf when I have more columns to fill?

create table testVarBinary (description nchar(10), img varbinary(max), etc..)

insert into testVarBinary 
SELECT BulkColumn
FROM OPENROWSET (BULK 'FullFilePath\\FileName.pdf', SINGLE_BLOB) as img

I know this works for the img but how do I fill the other columns?

this is just an example, some data may not be correct like the syntax.

0

There are 0 best solutions below