1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Retrieving BLOBs from SQL and saving to File System

Discussion in 'Databases' started by MasterBeta, Nov 16, 2005.

  1. #1
    So, I'm relatively new to SQL and it's eccentricities. I have a crap database that I inherited, this database was used by 1 individual to index all his files, word documents, spreadsheets, presentations, emails, images, etc, all as BLOBs. The client piece of this product is called scopeware and is not functioning. He wants all his files extracted from the SQL database and saved to the file system. I have looked around and found a few ways to extract these files and save them, primarily using ADO, but I can't find a good script samlple, I would appreciate any help from you folks.

    Thanks.

    Details: SQL Server 2000
    BLOB Column Type: Image
     
    MasterBeta, Nov 16, 2005 IP
  2. hdpinn

    hdpinn Peon

    Messages:
    48
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Did you try just grabbing the data with a query and in the loop write the data to a file:

    i'm lazy now so code may be sloppy and i just wrote it quick right here.

    $query=mysql_query("select...");
    $count =1;
    while ($value = mysql_fetch_array($query)) {
    $fp = fopen("myimagename" . $count . ".jpg", "w");
    fputs($fp, $value['image_column_name']);
    fclose($fp);
    
    $count++;
    }
    PHP:
     
    hdpinn, Nov 26, 2005 IP