Options

Problem with Blob field

waynewilwaynewil Member Posts: 41
edited 2003-09-10 in Navision Financials
Hi,

We've got a client on 2.60 Navison Server, whereas we use only 3.60 SQL Server.

Client needed us to dataport data out of a backup table and into the production table under an emergency situation. Table has five blob fields, all containing text. Dataport wouldn't handle the blob fields, so we restored the key/value data but not the blob data.

Now, we need to restore the blob portion of the data.

My understanding is: I'll need to create a program iterating through the backup table, finding matching index value in production table, then updating missing field data. The question is, do I have to use streams to achieve this, or is there some easier method?

waynewil

Comments

  • Options
    eromeineromein Member Posts: 589
    Maybe you can do the following (unless I misunderstood the question):


    Make a batch that exports the blob files. The filename of those files should include the key plus field number. Sample:

    If you key is "Customer, Postingdate" the filename should be something like 100000919031.txt (customer 10000, date 091003, field 1).

    Now write an batch that can import these files.

    But if you want to transfer fields between tables within one database it should be possible to do this without exporting. I think.
    Source.get(Key);
    Source.calcfields(Blob);
    
    Target.Key := Source.Key;
    Target.Blob := Source.Blob;
    IF not Target.insert then
      Target.modify;
    

    Code has not been tested.
    "Real programmers don't comment their code.
    If it was hard to write, it should be hard to understand."
  • Options
    waynewilwaynewil Member Posts: 41
    First, thank you so much for your response.

    Your approach makes the most sense of any suggestions I've had so far.

    Part of my problem in dealing with this issue is a poor understanding of the BLOB implementation in CSIDE, and in particular 2.60, neither of which are improved by scant documentation.

    Are you suggesting that I iterate through the source table in database #1, producing a keyed text file for each field using b.Export, then iterate through the target table in database #2, using the b.Import function to populate the BLOB fields with the contents of their corresponding text files?

    Waynewil
  • Options
    eromeineromein Member Posts: 589
    yes or...

    Looping the files and finding the records that belong to the textfile (otherway around). But if you do it this way, be sure to know the file loop bug and how to solve it (see http://www.mibuso.com/forum/viewtopic.php?t=1672).

    But another suggestion.

    You can create a (new) table in database 1 that is the same as in database 2. Then you fill this table in database 1 with batches. Now you can use the transfering blob bit from my previous post. When completly filled, just copy and past all the record from this table from database 1 to the table in database 2.

    Hint: before writing all those batches, be sure you test the copy past part first. Could be that the table should have the same table numbers.
    "Real programmers don't comment their code.
    If it was hard to write, it should be hard to understand."
Sign In or Register to comment.