H‌ow to extract PDF in SQL table as binary data and save them into a file saver as PDF file?

  • One table from another company in which a lot of PDF files were saved as binary data in one column.
    How to extract PDF in SQL table and save them into a file saver as PDF file?

  • adonetok - Thursday, May 31, 2018 8:22 AM

    One table from another company in which a lot of PDF files were saved as binary data in one column.
    How to extract PDF in SQL table and save them into a file saver as PDF file?

    If each row also had a filename, you might most easily so this using dynamic SQL and a cursor to loop through the records, so that you can use BULK OUTPUT.   And what, exactly, do you mean by a "file saver" ?

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • Yes, one column stored pdf file name.
    But, how to convert byte to pdf?

  • adonetok - Thursday, May 31, 2018 1:57 PM

    Yes, one column stored pdf file name.
    But, how to convert byte to pdf?

    Look up BULK OUTPUT.   You'll need some dynamic SQL to generate the code to be executed.   Also look up sp_executesql, which is a Microsoft provided stored procedure that will execute the SQL you create.    You'll need to set up a cursor to loop through each individual row in that table, and for each row, generate a SQL command dynamically, which command will perform the BULK OUTPUT and supply the filename as part of the command.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

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

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