MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 2nd, 2004, 04:05 AM
sochanik sochanik is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Posts: 67 sochanik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Advice on importing Access data into MSSQL table using code

Hi,

I'm about to embark on writing some code in perl or VBscript that automatically synchronises a constantly updated Access database with an MSSQL database.

I know MSSQL has an import tool built into Enterprise manager but I'm wondering if theres a stored procedure that does this?

The way I'm thinking of doing it is to read the all the access tables into separate hash arrays and then INSERTing them into the MSSQL database after checking for any duplicates. This all sounds a bit time consuming (there are a large number of tables) and processor intensive.

If anyones done anything like this before, I'd love to hear their views......!

Thanks!

Reply With Quote
  #2  
Old August 2nd, 2004, 03:37 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 44 m 30 sec
Reputation Power: 8
What are you going to use for a scheduler? You will still need to user MSSQL jobs or else you will need an external scheduler to perform this for you. What is wrong with using the DTS?
__________________
El éxito consiste en una serie de pequeñas victorias día a día

MySQL, MS SQL, MS ACCESS, Oracle Database Manager - http://victorpendleton.net/products/psdviewer.html

Reply With Quote
  #3  
Old August 3rd, 2004, 03:53 AM
sochanik sochanik is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Posts: 67 sochanik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Ha - funny you should say that, after writing this post, I went and had a look at what Enterprise Manager had to offer and the DTS looks great so I'll be using that!

My only problem is that I have no control over the database I'm importing the data on and it has no "new data" flag so at the mo I have to copy the entire table across and then remove duplicates. The database is Access 97 and is populated by some third party software.

As far as I could find there was no way of comparing two tables from completely seperate databases before I transfer the data across.

What I may do is import each table into a temporary table from Access to MSSQL and then write a query that compares the data between the live table and the temp table and copies the data across accordingly. Do you think this a good way of going about it?

Reply With Quote
  #4  
Old August 3rd, 2004, 12:11 PM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 44 m 30 sec
Reputation Power: 8
Take a look at the subscription replication for the DTS. Check to see if it can handle heterogenous database replication.

Reply With Quote
  #5  
Old August 4th, 2004, 03:11 AM
sochanik sochanik is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Posts: 67 sochanik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Cheers - it looks like it can. I'll give it a try and post my findings.

Reply With Quote
  #6  
Old August 4th, 2004, 07:00 AM
sochanik sochanik is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Posts: 67 sochanik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Actually, the subscription replication doesn't support subscribing from a heterogenous db, only publishing to. You have to write your own program in VB or C++ in order to do this, using the Microsoft SQL snapshot Control dll (sqlinitx.dll).

Looks unneccesarily complicated!

Reply With Quote
  #7  
Old August 4th, 2004, 09:56 AM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 44 m 30 sec
Reputation Power: 8
Is the MS Access database read only? Will updates come from both MS SQL and users? Will the data in MS Access need to be published back to MS SQL?

Reply With Quote
  #8  
Old August 4th, 2004, 10:02 AM
sochanik sochanik is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Posts: 67 sochanik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
The database is read only and updates will only come from the third party software, nowhere else. The data will never need to be published back to Access (the data is being replicated from Access to MSSQL). So it would literally be a straightforward merge from the Access DB to the MSSQL db.

I need it in MSSQL because its alot faster, and as the Access Db is version 97 I'm not able to use a whole series of SQL queries that I need to on the data stored therein... :-)

I've spent all day practically trying to figure out a way of replicating from Access to MSSQL and I haven't managed it. I've managed everything else - merging from MSSQL to Access, from MSSQL - MSSQL, but not from Access to MSSQL (I guess it would need to use ODBC)

Reply With Quote
  #9  
Old August 4th, 2004, 10:25 AM
victorpendleton victorpendleton is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2003
Location: No es importante
Posts: 2,065 victorpendleton User rank is Private First Class (20 - 50 Reputation Level)victorpendleton User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 44 m 30 sec
Reputation Power: 8
If you are going from MS Access to MS SQL you could use an ODBC link tool. I believe this is avaible in the version you are using. Create the table in MS SQL and create a linked table in MS Access.
...
If the project will be displayed in MS SQL why is the data not directly entered into MS SQL? Just a question. You may run into file contention issues and slowness when using MS Access as your data entry point if your number of concurrent users grows.

Reply With Quote
  #10  
Old October 18th, 2004, 12:03 PM
BlueIrishs2k BlueIrishs2k is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 7 BlueIrishs2k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by victorpendleton
If you are going from MS Access to MS SQL you could use an ODBC link tool. I believe this is avaible in the version you are using. Create the table in MS SQL and create a linked table in MS Access.
...
If the project will be displayed in MS SQL why is the data not directly entered into MS SQL? Just a question. You may run into file contention issues and slowness when using MS Access as your data entry point if your number of concurrent users grows.


I've got the same type of issue. My 3rd party application writes to an Access 97 database that is not editable, hence I cannot add any pass-through queries on it to help with the data transformation.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Advice on importing Access data into MSSQL table using code


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway