Importing PDF files to Sql server database

  • I'm working for an Aviation product involving in an application integration with other system. My requirement is to store the PDF file contents into our sql server database, which I will be getting from other software system. I want to do this using SSIS and I would like to know the possible ways.

  • I would like to know a good way to

    do this too, I suppose we have to use

    BI studio and import column transformation

    for this.

    But because I really don't use BI studio,

    a sample would be good... 🙂

    Thx

  • try this, substituting where specific

    CREATE TABLE PDFImageTest (account_num integer,image_data VARBINARY(MAX));

    DECLARE @AccountNum integer

    SET @AccountNum = 2456789

    INSERT INTO PDFImageTest (account_num,image_data)

    SELECT @accountNum,image_data

    FROM OPENROWSET(BULK N'C:\Backup\Disk Usage by Top Tables - 6262008 441 PM - PRDBTST2.pdf',SINGLE_BLOB) AS ImageSource(image_data);

    Select * from PDFImageTest

    -- Export image

    declare @SQLcommand nvarchar(1000)

    set @SQLcommand = 'bcp "SELECT image_data FROM PRDBDEV_UA.dbo.PDFImageTest" queryout "c:\backup\testExport.pdf" -T -n'

    exec master.sys.xp_cmdshell @SQLcommand

    go

  • Thanks!

    Will try 🙂

  • Great ,it works OK!!

  • im trying this, it had no problem on insertion, but when i use bcp command to retrieve it, no error prompt, but no file save into the path i've specified. Why? Please Advice, thanks...

  • The solution in SSIS is to use the standard Import Column transformation.

    ---
    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

Viewing 7 posts - 1 through 6 (of 6 total)

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