开发者

Import .txt file to SQL Server 2008

I want to import the text fil开发者_开发百科e 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.

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.


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

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

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜