从文本文件导入数据以附加到表 [英] Importing data from text file to append to table

查看:146
本文介绍了从文本文件导入数据以附加到表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将数据库中的某些值导出到文本文件,然后将这些值导入并应用到同一数据库表的另一个副本中,同一个表位于另一个位置


当我尝试导入值时,我收到一条错误,指出由于密钥违规导致X记录丢失。我怀疑我试图将值放到自动编号字段中,因此发生了错误。


然后我创建了一个查询,导出除了primayrkey自动编号字段之外的所有其他字段。对于此操作,我还会收到一条错误消息,指出我无法记录更改,因为输入的值违反了为表或集定义的设置。


我正在访问2007年


我希望有一种方法可以导入我导出的内容并直接附加到表中,因为我希望只需点击一下鼠标即可执行emport过程。

这篇文章连接到项目,如我在上一篇文章中描述的在Access中自动执行数据导出和导入

I am trying to export some values from a table in my database to a text file then have these values imported and apprnded to another copy of the same database table the same table in another location

When I tried to Import the values I got an error stating that X record have been lost due to a key violation. I suspected that I was trying to put values to a auto number field and hence the error occured.

I then created a query that exported all other fields but the primayrkey autonumber field. To this action i also get an error stating that I cannot record changes because the value entered violates settings defined for the table or set.

I am working in access 2007

I do hope that there is a way to import what I Exported and append directly to a table as I want to be able to execuit the emport process with just one mouse click.

This post is connect to the project as describe in my previous post at Automating Data export and import in Access

推荐答案

只需确保发送部门ID是密钥的一部分并确保对于每个指定的索引,该字段都存在以防止欺骗。


Nic; o)
Just make sure that the sending department ID is part of your key and make sure that for every specified index this field is present to prevent dupes.

Nic;o)


您是否在目标表中设置了任何字段有任何限制设置?例如,不能为空。


这些应该至少与原始表一样松散。理想情况下完全放松它们并添加回你想要的任何限制,直到它工作或你看到哪个限制导致了问题。
Do you have any fields set in the destination table with any restrictions set? Cannot be Null for instance.

These should be at least as loosely set as the originating table. Ideally loosen them up fully and add back in any restrictions you want until it either works or you see which restriction is causing the problem.


我希望将数据导入到表中其结构完好无损。这不是一次性的进口,每个月必须从大约20个不同的数据库进行。我正在考虑在导入数据时创建一个临时表,然后运行追加查询以将记录添加到表中。


这种方法可能会起作用,但它带来了很多头脑。我必须在完成将数据附加到主表后删除表格...我还在考虑如何最好地解决这个问题。


这是正确的方法?会有用吗?是否有更轻松的想法漂浮在那里的某些软件......?我喜欢听你的帮助!
I want the data to be imported into the table with all of its structure intact. this is not a one off import it has to be done every month from about twenty different databases. i am thinking about creating a temporary table at the importation of the data then run an append query to add the records to the table.

This method just might work but it brings a lot of over heads. I have to some how remove the table after I finish appending the data to the main table... I am still thinking about how best to go about this.

Is this the right approach? would it work? is there a lighter idea floating around someware out there...? I love to heare from you please help!


这篇关于从文本文件导入数据以附加到表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆