In the previous post we saw that how to load the image into the database table.
Uploading
the Image into sql server using SSIS
https://bageshkumarbagi-msbi.blogspot.com/2021/03/uploading-image-into-sql-server-using.html
We can
insert the image in below way.
- Using UI Application: as we know we are storing the image into the varbinary data type. So in the application first of all we are converting the image into the binary and then storing the data into the database.
- SSIS package: Read here.
Ad hoc we
are getting the requirement to inset the image (photo) in the table. In this demo
we will see that how we can update the Image into the data base table.
For Demo we
are taking the “AdventureWorks2017”
Database.
We are
inserting a record in the table “Production.ProductPhoto”.
Before
inserting the data into the table we need to below property on the server
level.
USE MASTER GO EXEC sp_configure 'show advanced options', 1; GO RECONFIGURE; GO EXEC sp_configure 'Ole Automation Procedures', 1; GO RECONFIGURE; GO -- Add 'bulkadmin' to the correct user ALTER SERVER ROLE [bulkadmin] ADD MEMBER [NT AUTHORITY\SYSTEM] GO |
Now we are writing the below sql script to upload the photo to the database.
We are inserting to the below photo in the table.
See this item is not available into the table.
Below SQL Script is used to upload this photo into the
database.
DECLARE @LargePhotoFileName_Path NVARCHAR(4000), |
Running this script.
Photo
uploaded successfully.
See the records in the table.
In this way, we can upload the image into the database.
In the next post we will see how to export these images into the folders.
Read Here :
No comments:
Post a Comment
If you have any doubt, please let me know.