Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2006
    Posts
    9

    Unanswered: Change table location

    Hi everybody,

    I'm very new in pervasive, not in vb.
    My company has a pervasive database where it writes some data of the production process.

    In the database there is only one table called "Production".
    The table location for this table is PT0401.btr that indicates "Production Table year 2004 line 01", PT0402.btr that indicates line 02, and so on. So we have the same table for different data (the database was designed as it is...)

    Due to the amout of data daily written in this table, every year we change the name of the file. So today the file is called PT0601.btr

    However, in the database X$File table it appears the first file, PT0401.btr (because the database is filled with a program which I don't have the sources)

    I would like to access to the PT0601.btr file via a SQL query in vb for excel or access, because I would like to automate a process to import data to an excel file.

    I tried to create another database with a new table using the PT0601.btr file, but when creating the new table the information is not being imported as it is in the original file (the colums are labelled with unnamed_0, unnamed_1 and so on.. some fields are joined in the same field etc.)

    Does anybody how to do this?
    Thanks a lot in advanced!!

  2. #2
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    What version of PSQL are you using?
    You'll need to know the exact record structure to create a new copy of the table definition.
    What you could try would be to copy the DDFs and your data file to another directory. THen issue an ALTER TABLE using the IN DICTIONARY and USING clauses to change the file name. Import your data then copy the newly modified data file back to the original location. You'd want to do this outside of business hours so there's no data consistency problems.
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    http://www.mirtheil.com
    I do not answer questions by email. Please post on the forum.

  3. #3
    Join Date
    Aug 2006
    Posts
    9
    I'm using PSQL7
    It worked with a database manager ... Thanks a lot!
    (I had to try inside business hours but with a copy of the entire server folder!! There are no "out of business hours"... But there were no problems of data consistency)

    Now im trying it in visual basic for excel, but the command ALTER TABLE is not doing any effect. I'm using a library called OLEBASELib, and I also tried to do it with ADODB objects, but as usual, I don't know how to open the connection and if once opened it is going to work.
    Is out there any easy library to use?
    Anyone knows how to implement in visual basic with ADODB?
    Thanks!!

  4. #4
    Join Date
    Dec 2001
    Posts
    1,109
    Provided Answers: 4
    The ALTER TABLE won't take effect until the next login since the DDFs are cached when opened.
    You'll need to close the connection and reopen it.
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    http://www.mirtheil.com
    I do not answer questions by email. Please post on the forum.

  5. #5
    Join Date
    Aug 2006
    Posts
    9
    Thx a lot!! It worked very fine!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •