How to store image in SQL Server database tables c

2019-01-07 06:53发布

This question already has an answer here:

I Have a table named FEMALE in my database. It has ID as Primary Key, it has an Image column.

My Question is how do I store an image using a SQL Query?

2条回答
虎瘦雄心在
2楼-- · 2019-01-07 07:20
Insert Into FEMALE(ID, Image)
Select '1', BulkColumn 
from Openrowset (Bulk 'D:\thepathofimage.jpg', Single_Blob) as Image

You will also need admin rights to run the query.

查看更多
▲ chillily
3楼-- · 2019-01-07 07:21

give this a try,

insert into tableName (ImageColumn) 
SELECT BulkColumn 
FROM Openrowset( Bulk 'image..Path..here', Single_Blob) as img

INSERTING

enter image description here

REFRESHING THE TABLE

enter image description here

查看更多
登录 后发表回答