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.

Move blob from one MS Sql Server to Another?

Discussion in 'Databases' started by North Carolina SEO, Aug 4, 2006.

  1. #1
    I posted a question on the PHP section of this forum but, maybe this is the better place to ask...

    Does anyone have php code for moving an image - blob field that already exists within one Microsoft Sql Server 2005 database (e.g. external) to a local shared Microsoft Sql Server 2005 database?

    I am able to move all the other fields of the database except the image field.

    HELP PLEASE!!! :eek:
     
    North Carolina SEO, Aug 4, 2006 IP
  2. adacprogramming

    adacprogramming Well-Known Member

    Messages:
    1,615
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    125
    #2
    I haven't done it with PHP, but blob is just binary data. Maybe the problem is you are trying to move too much data for the PHP defaults. You might be able to adjust the defaults in the connection string.

    If this is a onetime move it would be easyer to do with enterprise manager. (MS SQL Server's)
     
    adacprogramming, Aug 4, 2006 IP
  3. North Carolina SEO

    North Carolina SEO Well-Known Member

    Messages:
    1,327
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    105
    #3
    This is not a one time move. This process would need to run daily. Also, I don't receive an error related to beyond the data size limits.
     
    North Carolina SEO, Aug 5, 2006 IP
  4. adacprogramming

    adacprogramming Well-Known Member

    Messages:
    1,615
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    125
    #4
    Well, your not getting any help with the PHP, ( and I can't help much there). But here is another option.

    Create a job on SQL Server and have it run at the required intervals moving the data over.

    You can also use replication and push the data to the remote server (or pull).

    I believe you could also create a stored procedure in SQL server and then call the procedure when ever you want from PHP.
     
    adacprogramming, Aug 5, 2006 IP
  5. North Carolina SEO

    North Carolina SEO Well-Known Member

    Messages:
    1,327
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    105
    #5
    Alas, thanks to others on the web forums I have the answer! Converting the data connection to Adodb and converting with the following function, I have been able to sql insert the data from the external MS Sql Server to the local MS Sql Server. Thanks to all who assisted in any manner.

    function storeimage($fldimage) {
    // Handling IMAGE - BLOB fields
    $imgdata = unpack("H*hex", $fldimage);
    $imgdataresult = "0x".$imgdata['hex'];

    return $imgdataresult;

    } // END function storeimage($fldimage) {
     
    North Carolina SEO, Aug 9, 2006 IP