I'm trying to insert an image into the database.
CREATE TABLE ImageTable
(
Id int,
Name varchar(50) ,
Photo varbinary(max)
)
INSERT INTO ImageTable (Id, Name, Photo)
SELECT 10, 'John', BulkColumn
FROM Openrowset( Bulk 'C:\caldophilus.jpg', Single_Blob) as EmployeePicture
It throws me an error.
Cannot bulk load. The file "C:\caldophilus.jpg" does not exist.
Please Help.
A database gives you the opportunity to store photos and other small images in a database table. You can create such a database table for example when you want to create an online photo album with descriptions of your photos. Storing images in a database table is not recommended.
1) Bring up SQL Server Management Studio. 2) Connect, and open the database you want to add the image to. 3) Expand the tables, and either add a new table with an appropriate index field, or right click teh table and select design. 4) Add a field called "myImage", and make its datatype "image".
1 Answer. You can try the below code for inserting an image: INSERT INTO xx_BLOB(ID,IMAGE) VALUES(1,LOAD_FILE('E:/Images/jack. jpg'));
The file is probably on your client PC.
Don't forget that C:\ refers to the server C drive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With