Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xp_cmdshell To Extract PDF's 1

Status
Not open for further replies.

Skittle

ISP
Sep 10, 2002
1,528
US
I have a stored procedure that calls xp_Cmdshell to extract a PDF file from a blob to disk.
In the stored procedure it does something like this.

Code:
...
...
...
DECLARE @bcpCommand varchar(1000)      -- Command
SET @bcpCommand = 'bcp "SELECT Invoice_PDF_Image FROM [MyDB].dbo.[Invoices] WHERE invoice =  ''I18450''    "  queryout "C:\Invoices\I18450.pdf" -T -n -S UKPC-02'
EXEC master..xp_cmdshell @bcpCommand;
...
...
..
[/code]

It works well but I'm a bit concerned about allowing xp_cmdshell.
Is there another way I could do this within an SQL Stored Procedure without using xp_cmdshell?



Dazed and confused.

Remember.. 'Depression is just anger without enthusiasum'.
 
You could isolate the permissions a little better by having the stored procedure push a message onto a service broker queue, then having a second (admin run) procedure read that queue, and extract the BLOBs.
 
OK thanks, I'll look into it.

Dazed and confused.

Remember.. 'Depression is just anger without enthusiasum'.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top