简体   繁体   中英

Informatica: downloading image data type to disk

I have a table in sql server that contain two columns

Filename char datatype
File image datatype

Requirement is to download all the data to the disk , is it possible using informatica and if yes how?

For example, if there are two rows in the table:

sal_1.pdf, <<image data>>
sal_2.pdf, <<image data>>

and it needs to be pushed to disk D:/file_dump directory then D:/file_dump should have two files with the names sal_1.pdf and sal2.pdf .

You could use T-SQL and bcp ( link 1 , link 2 ) like this:

1) Write a T-SQL script (using SQL Server Management Studio) to generate all shell/bcp commands

SET NOCOUNT ON;
SELECT  'bcp "SELECT y.File FROM Schema.Table y WHERE y.IDColumn=' 
    + CONVERT(VARCHAR(11),x.IDColumn) 
    + ' queryout "D:\file_dump\' 
    + x.FileName 
    + '" -N -S SqlServerInstance -T -d "DatabaseName"'
FROM Table x

Press Ctrl+T (Text results)

Press F5 (Execute)

Press F6 (It activates the Results (text) panel

Press Ctrl+A (Select All)

Press Ctrl+C (Copy)

2) Create a new text file ( Win Key + Notepad + Enter ), Ctrl+V (Paste), Save As ... -> dump_pdf.bat

3) Execute dump_pdf.bat file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM