SQL Server text, ntext, and image data are character or binary string data types that can hold data values too large to fit into char, varchar, binary, or varbinary columns. After we store binary data on MS SQL IMAGE Column we want to export it.In this article I explain how to export MS SQL image column binary data
Share Permission for export Folder
Example: Export MS SQL image column binary data
SQL Query
DECLARE @ImageData VARBINARY (max),@varFileName VARCHAR(200),@varLocPath VARCHAR(500)
SET @varFileName ='AAA.JPG'
SET @varLocPath='\ServerNameimages'+@varFileName
SELECT @ImageData =(SELECT convert (VARBINARY (max), bytImage, 1) FROM Table WHERE Condition
EXEC sp_OACreate 'ADODB.Stream' ,@Obj OUTPUT;
EXEC sp_OASetProperty @Obj ,'Type',1;
EXEC sp_OAMethod @Obj,'Open';
EXEC sp_OAMethod @Obj,'Write', NULL, @ImageData;
EXEC sp_OAMethod @Obj,'SaveToFile', NULL, @varLocPath, 2;
EXEC sp_OAMethod @Obj,'Close';
EXEC sp_OADestroy @Obj;
How to export MS SQL image column binary data: Free Guide