如何以与文件顺序相同的顺序将Unicode文件加载到数据库中 [英] How to load a Unicode file into the database in the same order as the file order

查看:54
本文介绍了如何以与文件顺序相同的顺序将Unicode文件加载到数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



数据文件是一个带有文本行的简单Unicode文件。 BCP

显然不保证这个订单,

导入工具也没有。我希望能够按顺序加载数据或

将行编号添加到大型Unicode文件(100万行)。如果可能的话,我不会想要处理另一种编程语言,而且我想知道在SQL Server中是否有一个技巧可以实现这一目标。


感谢您的帮助。


Mark Leary



---- ==通过Newsfeeds.Com发布 - 无限制 - 未经审查 - 安全使用网新闻== ----
http ://www.newsfeeds.com 世界排名第一的新闻组服务! > 100,000新闻组

--- =东/西海岸服务器农场 - 通过加密的总隐私= ---


The data file is a simple Unicode file with lines of text. BCP
apparently doesn''t guarantee this ordering, and neither does the
import tool. I want to be able to load the data either sequentially or
add line numbering to large Unicode file (1 million lines). I don''t
want to deal with another programming language if possible and I
wonder if there''s a trick in SQL Server to get this accomplished.

Thanks for any help.

Mark Leary


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---

推荐答案

no-email写道:
no-email wrote:
数据文件是一个带有文本行的简单Unicode文件。 BCP
显然不保证这个订单,
导入工具也没有。我希望能够按顺序加载数据,或者将行编号添加到大型Unicode文件(100万行)。如果可能的话,我不想处理另一种编程语言,并且我想知道SQL Server中是否有一个技巧可以实现这一目标。

感谢任何帮助。

Mark Leary
The data file is a simple Unicode file with lines of text. BCP
apparently doesn''t guarantee this ordering, and neither does the
import tool. I want to be able to load the data either sequentially or
add line numbering to large Unicode file (1 million lines). I don''t
want to deal with another programming language if possible and I
wonder if there''s a trick in SQL Server to get this accomplished.

Thanks for any help.

Mark Leary




为什么插入表中的行的顺序在你的

中很重要案件?关系数据库不理解行顺序。如果你需要它们在导入后以某种方式排序,你可以在表格上创建一个聚集索引,以便以一种有助于查询的方式排序行br />
表现更好。


一般情况下,我认为BCP会顺序处理文件中的行。但是再次确认
,我不清楚为什么这很重要。


你能否详细说明你要避免的确切问题。

-

David Gugick

Imceda Software
www.imceda.com



Why does the order of the rows inserted into the table matter in your
case? Relational databases don''t understand row order. If you need them
sorted in some way after the import, you can create a clustered index on
the table to get the rows ordered in a way that helps your queries
perform better.

In general, I think BCP processes the rows in the file sequentially. But
again, I''m not clear on why this matters.

Could you elaborate on the exact issue you are trying to avoid.
--
David Gugick
Imceda Software
www.imceda.com




" David Gugick" <哒*********** @ imceda.com>写道:

"David Gugick" <da***********@imceda.com> wrote:
为什么插入表格的行的顺序在你的
情况下很重要?关系数据库不理解行顺序。如果您需要在导入后以某种方式对它们进行排序,您可以在表格上创建聚集索引,以便以有助于您的查询更好地执行的方式获取订购的行。 />
一般来说,我认为BCP按顺序处理文件中的行。但是再次,我不清楚为什么这很重要。

你能否详细说明你要避免的确切问题。
Why does the order of the rows inserted into the table matter in your
case? Relational databases don''t understand row order. If you need them
sorted in some way after the import, you can create a clustered index on
the table to get the rows ordered in a way that helps your queries perform
better.

In general, I think BCP processes the rows in the file sequentially. But
again, I''m not clear on why this matters.

Could you elaborate on the exact issue you are trying to avoid.



我正在尝试按顺序加载文本文件,以便使用依赖于确切顺序的T-SQL执行文本操作。只需在Unicode文本

文件的每一行添加一个行号,然后加载确定顺序的行号的文件,我就会很高兴,但是
/>
如果可能,我想避免使用其他语言编程。最终,

加载的文本将转换为适当的关系表。这并不意味着b $ b与提高性能有关。这有用吗?


谢谢。



I am trying to load a text file sequentially in order to perform text
manipulations using T-SQL that do depend on the exact order. I would be
happy with simply adding a line number to each line of the Unicode text
file, and then loading the file with line number determining the order, but
I want to avoid programming in another language if possible. Eventually the
loaded text would be converted to proper relational tables. This doesn''t
have to do with improving performance. Does this help?

Thanks.


no-email写道:
no-email wrote:
" David Gugick" ; <哒*********** @ imceda.com>写道:
"David Gugick" <da***********@imceda.com> wrote:
为什么插入表格的行的顺序在你的
情况下很重要?关系数据库不理解行顺序。如果您需要在导入后以某种方式对它们进行排序,您可以在表格上创建一个聚簇索引,以便以有助于您的查询更好地执行的方式获取订购的行。 />
一般来说,我认为BCP按顺序处理文件中的行。
但是,我不清楚为什么这很重要。

你能详细说明吗?您试图避免的确切问题。
Why does the order of the rows inserted into the table matter in your
case? Relational databases don''t understand row order. If you need
them sorted in some way after the import, you can create a clustered
index on the table to get the rows ordered in a way that helps your
queries perform better.

In general, I think BCP processes the rows in the file sequentially.
But again, I''m not clear on why this matters.

Could you elaborate on the exact issue you are trying to avoid.



我正在尝试按顺序加载文本文件,以便使用依赖于确切的T-SQL执行文本操作订购。我会很高兴只需在Unicode
文本文件的每一行添加一个行号,然后用确定
顺序的行号加载文件,但我想避免编程另一种语言如果可能的话。最终,加载的文本将转换为正确的关系表。这与提高性能没有关系。这有帮助吗?
谢谢。



I am trying to load a text file sequentially in order to perform text
manipulations using T-SQL that do depend on the exact order. I would
be happy with simply adding a line number to each line of the Unicode
text file, and then loading the file with line number determining the
order, but I want to avoid programming in another language if
possible. Eventually the loaded text would be converted to proper
relational tables. This doesn''t have to do with improving
performance. Does this help?
Thanks.




是的。听起来你有一个特定顺序的行,需要在SQL Server上处理一次
。您希望在文件中保留行的顺序

,这样就可以在SQL上以相同的顺序处理行

Server。


为了在任何关系数据库中执行此操作,您需要一个排序键。

从来没有保证您在没有ORDER BY的情况下运行的查询将

以任何一致的方式返回相同顺序的行。

我的理解是BCP按照它们出现在

a文件中的顺序提供行。我无法想象它会以不同的方式做任何理由。

在这种情况下,您希望将数据插入到包含

IDENTITY列的表中。然后你可以在你的ORDER BY中使用那个键来处理任何进程中的行。

-

David Gugick

Imceda Software
www.imceda.com



Yes. It sounds like you have rows in a specific order that will need to
be processed once on SQL Server. You want to preserve the order of rows
in the file so the rows can be processed in the same order once on SQL
Server.

In order to do this in any relational database, you need a sort key.
There is never a guarantee that a query you run without an ORDER BY will
return rows in the same order in any consistent way.

My understanding is that BCP feeds the rows in the order they appear in
a file. I can''t imagine any reason it would or could do it differently.
In that case, you want to insert the data into a table that contains an
IDENTITY column. You can then use that key for your ORDER BY when
processing the rows from whatever process does that.
--
David Gugick
Imceda Software
www.imceda.com


这篇关于如何以与文件顺序相同的顺序将Unicode文件加载到数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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