Here's a quick and dirty VB Script I munged together from the interwebs to pull out Image data from a SQL table and write the stored PDF files to disk. Edit heavily. You'll need to enter your server and DB names into the SQL connection string.
'VBS to read a BLOB (actually Image) column in SQL Server and save each row's image to a file.
'Example here reads PDFs stored in DocImage.Image column and saves each to a PDF file.
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
outPath = "C:\Images"
Set rs = CreateObject("ADODB.Recordset")
cn = "Provider=SQLOLEDB;Data Source=mySQLServer;Initial Catalog=myDatabase;Integrated Security=SSPI;"
sql = "SELECT s.LastName + '_' + s.FirstName + '_' + CAST(di.DocTrackID AS VARCHAR(20)) As strFileName, Image " & _
"FROM DocImage di INNER JOIN " & _
"DocTrack dt ON di.DocTrackID=dt.DocTrackID INNER JOIN " & _
"Student s ON dt.StudentUID=s.StudentUID " & _
"WHERE ContentType='application/pdf'"
rs.Open sql, cn
While Not rs.EOF
fOut = outPath & "\" & rs.Fields("strFileName").Value & ".pdf"
Set stream = CreateObject("ADODB.Stream")
With stream
.Type = adTypeBinary
.Open
.Write rs.Fields("Image").Value
.SaveToFile fOut, adSaveCreateOverWrite
.Close
End With
rs.MoveNext
Wend
rs.Close
Hope this helps,
Rich