Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to convert the pdf file to blob type ? Expand / Collapse
Author
Message
Posted Tuesday, December 18, 2012 3:47 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Monday, April 11, 2016 7:04 AM
Points: 763, Visits: 910
Hi Friends,

I have a folder which contains thousands of pdf files where i have to convert into a blob file into a table. I have another table called Document which contains three columns called DocName and Doctype and fileSource.

The files in the directory is always named as like as the same name in the Document table.
For exapmle a pdf file holding the name called 15003786.pdf ...Exactly the same way we can see in the document table under DocName column. So my need is to look up for the names in the document table and process the matched files from the directory and convert it to blob data and insert into another table.

FYI I don't want to open the pdf document. I just want to convert it into a blob data.

Any suggestion woud be really appreciated. Help me friends..


Thanks,
Charmer
Post #1397664
Posted Tuesday, December 18, 2012 5:00 AM This worked for the OP Answer marked as solution


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Friday, April 29, 2016 7:35 AM
Points: 15,143, Visits: 13,031
You can use the Import Column task to import the PDF files into the database.



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at SQLKover.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1397702
Posted Tuesday, December 18, 2012 6:20 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Monday, April 11, 2016 7:04 AM
Points: 763, Visits: 910
Koen Verbeeck (12/18/2012)
You can use the Import Column task to import the PDF files into the database.


Yes Koen, I am using the import column component....but the task gets failed when a file is unavailble in the directory if it is specified in the table. How to avoid such cases?

A file name can be specified in a table where it may or may not be availble in the directory...So i need to skip if the file is not available and move to the next file....


Thanks,
Charmer
Post #1397746
Posted Tuesday, December 18, 2012 6:25 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Monday, April 11, 2016 7:04 AM
Points: 763, Visits: 910
Koen, FYI

"INSERT INTO [dbo].[Doc_Stage](DocName,DocPath,DocType) VALUES ('" +REPLACE(RIGHT(@[User::FilePath],FINDSTRING(Reverse(@[User::FilePath] ) ,"\\", 1)-1),RIGHT(@[User::FilePath],4),"")+ "','" + @[User::FilePath] + "','" + RIGHT( @[User::FilePath] ,FINDSTRING( REVERSE(@[User::FilePath] ),".",1)-1)+ "');"

I googled and found the above method of inserting the document name. I use this statement to insert the file name dynamically using a for loop containser and execute SQL task.....but this statement is not validated by the expression of execute sql task....could you help me please...?


Thanks,
Charmer
Post #1397751
Posted Tuesday, December 18, 2012 6:30 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Friday, April 29, 2016 9:42 AM
Points: 6,437, Visits: 13,117
Charmer (12/18/2012)
the task gets failed when a file is unavailble in the directory if it is specified in the table. How to avoid such cases?


Two options:
(1) Do a file existence check for each file, using xp_fileexist, a DOS command, a VB script, Powershell or however else you like to do it.

(2) Import the file list into a staging table and join that to your table of files so that you get a list that only includes files that exist.

John
Post #1397755
Posted Sunday, September 20, 2015 11:18 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, March 28, 2016 9:26 PM
Points: 6, Visits: 7
Hi, Charmer.
I have seldom tried to convert into a blob file into a table. I wonder have you worked it out? Do I need another 3rd party manual toolkit? When it comes to
PDF converting processI have another question, I wonder have you ever tried to convert pdf to other image files before? As for myself, I am testing the related PDF to PNG converting , PDF to BMP converting , and PDF to JPG converting programs these days. Do you have experience about it? Any suggestion will be appreciated. Thanks in advance.



Best regards,
Pan
Post #1721209
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse