Saturday, September 28, 2019

How to store image in SQL Server database table column


Below are the steps to import image file to sql server database

Step 1:

Create table

CREATE TABLE ImageUpload (
   ImageName NVARCHAR(40) PRIMARY KEY NOT NULL
   , ImgFileName NVARCHAR (100)
   , DataFile VARBINARY (max)
   )
GO

Step 2:

Insert record

insert into ImageUpload (ImageName, ImgFileName, DataFile)
select 'NewYearCake','Newyear.jpg',BulkColumn
FROM Openrowset( Bulk 'G:\Image\DSC02319.JPG', Single_Blob) as img


select * from ImageUpload



You can verify whether image got uploaded correctly by using SSRS.
Please visit the below link for more info.


Display Database Images in SSRS Report

2 comments:

  1. I have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks! Buy Fresh SMTP Shop

    ReplyDelete
  2. Glad to chat your blog, I seem to be forward to more reliable articles and I think we all wish to thank so many good articles, blog to share with us. Discount Shop Store Online

    ReplyDelete