473,387 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Select primary key with import spec?

Have been using macros to do automatic importing of flat text files
lately....wish I knew about his capability before :)

question: is there any way to specify one of the fields I import as
being the primary key? need to do this automatically, not manually.

the spec i create does have the ability to create an index, and one
with no duplicates....but can it make a field this field the primary
key as well?

thanks,

Larry
- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."
Nov 13 '05 #1
3 3735
On Wed, 01 Sep 2004 19:25:35 -0700, Larry Rekow <larry@netgeexdotcom>
wrote:

There are severe limitations to what you can do with macros. This is
one of them.
To paraphrase yourself: one day you'll discover VBA and its power, and
you'd wish...

-Tom.
Have been using macros to do automatic importing of flat text files
lately....wish I knew about his capability before :)

question: is there any way to specify one of the fields I import as
being the primary key? need to do this automatically, not manually.

the spec i create does have the ability to create an index, and one
with no duplicates....but can it make a field this field the primary
key as well?

thanks,

Larry
- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."


Nov 13 '05 #2
On Wed, 01 Sep 2004 22:11:45 -0700, Tom van Stiphout
<no*************@cox.net> wrote:
On Wed, 01 Sep 2004 19:25:35 -0700, Larry Rekow <larry@netgeexdotcom>
wrote:

There are severe limitations to what you can do with macros. This is
one of them.
To paraphrase yourself: one day you'll discover VBA and its power, and
you'd wish...

-Tom.

++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++
Won half the war. i destroy and make new tables each night after a
text report comes out of a UNIX box. Now I run a macro from access
that deletes the old table, copies an empty table (with the primary
key prefigured) to the table name I want. Then I do the transfer text
thing, importing the text report to a holding table. then run an
append query that appends the records to the new, empty table that
already has the primary key chosen on it. Not elegant, but workable.

but now my biggest problem: I can't seem to import this table from
Access to SQL and preserve the primary key. Googled all over, and
have had conflicting stories....some say you can't, others say you
can. Certainly if I could do it all using SQL DTS, I would, but I
can't figure out how yet.

Certainly if I did it manually, i guess I could do the Access upsize
wizard....that's supposed to keep the primary key..but it's not
automated.

so now i guess i'll have to find out how to use either VBA or VB.net
to see if i can make some sense of it all.

sheesh.

Larry

- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."
Nov 13 '05 #3
On Thu, 02 Sep 2004 09:22:51 GMT, Chuck Grimsby
<c.*******@worldnet.att.net.invalid> wrote:
On Wed, 01 Sep 2004 19:25:35 -0700, Larry Rekow <larry@netgeexdotcom>
wrote:
Have been using macros to do automatic importing of flat text files
lately....wish I knew about his capability before :)
question: is there any way to specify one of the fields I import as
being the primary key? need to do this automatically, not manually.
the spec i create does have the ability to create an index, and one
with no duplicates....but can it make a field this field the primary
key as well?


Never, never, never import into a new table. Import into an existing
table that has all the keys needed already set up. Use a delete query
to empty the table when/as needed.

Never *delete* a table if you are just going to re-create it. See
previous discussions on this for more information as to why that's a
bad practice.

++++++++++++++++++++++++++++++++++++++++++++++++++ ++
Makes total sense...thanks for the input. Now I just need to find out
how to do the same thing in a MS SQL 2000 db (empty or delete all
records in a table with defined primary key, and then append new
records to the table).

Larry
- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mark | last post by:
In Access 2000 and 2002, I have created an import specification to import the fixed-width recordset below into an existing table. I am having strange problems with the import of the date and time...
1
by: Dan | last post by:
Could someone please help me with auto importing a series of data files into an Access table. I tried to follow code given below in a previous messagebut i'm getting error messages. Here's my...
6
by: Vladislav Moltchanov | last post by:
I have discovered a couple of years ago, that import with DoCMD.TransferText for CSV text file doesn’t work in Acc2000, while it works perfectly in ACC97. which has been discussed on this...
4
by: pietlinden | last post by:
I almost feel stupid posting this, but maybe someone else understands what's going on here. I am importing a delimited text file, and have saved an import specification so that for the user the...
7
by: Janning Vygen | last post by:
Hi, i searched the docs and the archives and was really wondering that i have not found anything searching for "functional index primary key". i would like to have a table of members with...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
0
by: Donius | last post by:
Hello team. I'm running mysql 4.0.20-standard and i'm trying to do a query like this: INSERT IGNORE INTO `DonorPledges` ( nDonor_id, nPledgeYear, nTotalPaid, nTotalPledge ) SELECT
1
by: rwiethorn | last post by:
Hi all, It's been a while since I used MS Access. I remember a way of importing data (ie csv, or tab delimited) and formatting the data (ie specify data types, columns to skip, ect), then saving...
7
by: Brian | last post by:
I'm trying to run a select max() on a primary key/unique/non-identity column then + 1, all while running an insert into.. select statement. For some reason, the select max isn't quite doing the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.