将 .txt 文件导入 SQL Server 2008 [英] Import .txt file to SQL Server 2008

查看:62
本文介绍了将 .txt 文件导入 SQL Server 2008的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将文本文件导入 SQL Server 2008.显然,文本文件就像,

I want to import the text file to SQL Server 2008. Obviously, the text file is like,

AA89ATOZ                MR        1  PMANUAL   >0    1    0    0    0    0    0    0    0    0    0    0    1.

这条记录有一千条这样的记录.当我使用 excel 加载文本文件时,它将所有文本设置为一行.我已经阅读了一些相关的答案,即

The record has thousand records like this. When I load the text file using excel, it will be set all texts in one row. I have read some related answer, which is

AA89ATOZ,MR,1,PMANUAL,>0,1,0,0,0,0,0,0,0,0,0,0,1.

如果我可以像上面那样做,我该如何改变它?它是否具有按行拆分文本的功能?请让我知道答案.谢谢.

If I can do make like above, how can I change it? Does it have any function to split text on row? Please let me know the answer. Thanks.

推荐答案

您有多种选项可以将数据从文本文件插入 SQL Server.这里有一些被广泛使用的.

You have several options for inserting data into SQL Server from a text file. Here are a couple that are widely used.

SQL Server 导入和导出向导非常简单,生成的集成服务包可以保存并安排执行:

The SQL Server Import and Export wizard is pretty straightforward, and the resulting Integration Services package can be saved and scheduled for execution:

http://msdn.microsoft.com/en-us/library/ms141209.aspx

或者您可以使用 T-SQL BULK INSERT 命令.这要求文本文件位于数据库服务器文件系统上或可通过 UNC 路径获得:

Or you can use the T-SQL BULK INSERT command. This requires that the text file is either on the database server filesystem or available via UNC path:

http://msdn.microsoft.com/en-us/library/ms188365.aspx

这篇关于将 .txt 文件导入 SQL Server 2008的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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