By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,637 Members | 1,157 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,637 IT Pros & Developers. It's quick & easy.

Import Teradata SQL data into Access database table

P: 69
Version of Access = 2003

Hi there, is there a way to capture data using TERADATA SQL Assistant and import a portion of this database table into a Microsoft Access database table???

I currently have Teradata SQL Assistant and write SQL to retrieve data from clarity tables. I would like to have a button on a Microsoft Access form that would retrieve data directly from Clarity tables and import into a specific Microsoft Access database table.

Am not sure if this is possible. If this is possible, can someone please give me an example of code that would be used in order to accomplish this???

Thank you in advance for your assistance.
Jun 2 '08 #1
Share this Question
Share on Google+
4 Replies

P: 66

If you wanted to code something using VBA in MS Access that connected to the Teradata database, via ODBC, and retreived whatever data you wanted, then that should be reasonably simple.

If you want to try this then let me know and I can give you an example of a connection string and code that should work, assuming you already have the ODBC stuff setup for your Teradata database on your PC.

Jun 3 '08 #2

P: 69
I am not sure if this is what you are talking abuot, but when I am in Access I can do the following:

FILE / Get External Data / Import
Files of Type = ODBC
Machine Data Source tab = CLR_SC_ODBC
DBC Name or Address =
User Name = 1234
Password = ABCD

After doing this, it shows all the clarity tables.

I would like to be able to specify in a SQL query that I want to retrieve all records from the PAT_ENC table where CONTACT_DATE between Jan 1, 2008 and Jan 31, 2008 and lets say a dept = 'GMPNM'. Then have this data populate a table with the same fields in my Access database.

THANK YOU VERY MUCH for your assistance.

PS: I thought I would try to run the following code to transfer data from one Access database to another just to see how it would work. It would not put the data into the actual table, it would create a new table. I would have to go into the database and delete the newly created table after the data had been populated into the main table.

Not sure what I am doing wrong.
Expand|Select|Wrap|Line Numbers
  1. Private Sub LBL_RECEIPTS_Click()
  2. On Error GoTo Err_LBL_RECEIPTS_Click
  4.   DoCmd.TransferDatabase transfertype:=acImport, _
  5.   databasetype:="Microsoft Access", _
  6.   databasename:="C:\KATHY\TAX_DEDUCTIONS.mdb", _
  7.   objecttype:=acTable, Source:="T_RECEIPTS", _
  8.   destination:="T_RECEIPTS"
  10. Dim SQL_Text As String
  12. DoCmd.RunSQL (SQL_Text)
  14. Exit_LBL_RECEIPTS_Click:
  15.     Exit Sub
  17. Err_LBL_RECEIPTS_Click:
  18.     MsgBox Err.Description
  19.     Resume Exit_LBL_RECEIPTS_Click
  21. End Sub
Jun 3 '08 #3

P: 66

It sounds like you have everything in place already to do what you want.

If you have set up the tables from your SQL repository as external linked tables in MS Access, then you should be able to open them directly in VBA code as if they are local tables.

Alternatively you can reference them in SQL code as if they are local tables. You seem to have the basics covered already in your example SQL code above, except that it seems to be more elaborate than required (from my limited understanding).

You can just build your SQL string to select the fields you want, from the SQL table (as if it is a local table) and include whatever WHERE statements you need for your selection criteria.

A simple example of building a resultset from your SQL data would be:

Expand|Select|Wrap|Line Numbers
  2. InitialRst.Open SQLString
Or you can use your DoCmd.RunSQL example to put the result directly into a new table.

This assumes that you have declared your external SQL table PAT_ENC as a linked table in MS Access.

If this isn't helping then let me know. We may not be talking about the same things.

Jun 3 '08 #4

Expert Mod 15k+
P: 31,770
KMEscherich, As a full member now, you should know that we expect your code to be posted in [code] tags (See How to Ask a Question).
This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.
Please use the tags in future.

Jun 6 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.