Extract Images from database

  • Hello!

    I am exporting images from database to the network path using SSIS - Export Column, I have two fields in the database that have images, this works as expected as long as both the fields have image. But sometimes one of the field might have image or not, how to use export Column in that scenario to export data when one field have image and other does not.

     

    Thanks in advance.

     

     

  • What happens when only one of the columns has an image?

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • declare @path varchar(100)= 'c:\images\A\'

    declare @path1 varchar(100)= 'c:\images\B\'

    SELECT [ThumbNailPhoto],[ThumbNailPhoto1]

    ,@path+[ThumbnailPhotoFileName] AS Path

    ,@path1+[ThumbnailPhotoFileName] AS Path1

    FROM [AdventureWorks2012].[Production].[ProductPhoto]

    If ThumbNailPhoto is null and ThumbNailPhoto1 has image in the extract it is doing this:

    c:\images\A\Pic.jpg ( size 0 KB)

    c:\images\B\Pic.jpg ( size 1 KB)

    It is still writing to A folder, what I would like is for the file to be created only when there is image on the field.

     

  • I got it using case statement.

  • This was removed by the editor as SPAM

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply