If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Pervasive.SQL > Change table location

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-02-06, 10:41
miqmago miqmago is offline
Registered User
 
Join Date: Aug 2006
Posts: 9
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!!
Reply With Quote
  #2 (permalink)  
Old 08-02-06, 12:16
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 1,026
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.
Reply With Quote
  #3 (permalink)  
Old 08-02-06, 14:08
miqmago miqmago is offline
Registered User
 
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!!
Reply With Quote
  #4 (permalink)  
Old 08-02-06, 16:25
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 1,026
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.
Reply With Quote
  #5 (permalink)  
Old 08-11-06, 06:02
miqmago miqmago is offline
Registered User
 
Join Date: Aug 2006
Posts: 9
Thx a lot!! It worked very fine!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On