如何将文本文件作为SQL表中的列导入 [英] How to import text files as columns in a SQL table

查看:75
本文介绍了如何将文本文件作为SQL表中的列导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是sql的新手,我有多个文本文件,我必须作为单独的列导入到sql表中。

假设我有文件名为file1,file2,file2。我需要将这3个文件导入名为TEST的表中,作为名为file1,file2,file2的列。

我使用的是sql server 2017.



我尝试了什么:



我可以使用导入向导将文件作为不同的表导入。

解决方案

检查: OPENROWSET(Transact-SQL)| Microsoft Docs [ ^ ]


如果文本文件很大,您可以尝试批量插入,请参见此处的示例:

批量将.NET列表插入数据库 [ ^ ]

I am new to sql and I have multiple text files which i have to import into a sql table as individual columns.
Say I have text files named file1 ,file2 ,file2. I need to import these 3 files into a table named TEST as columns named file1 ,file2 ,file2.
I am using sql server 2017.

What I have tried:

I'm able to import the files as different tables using import wizard.

解决方案

Check this: OPENROWSET (Transact-SQL) | Microsoft Docs[^]


If the text files are large, you could try Bulk Insert, see example here:
Bulk Insert a .NET List to Database[^]


这篇关于如何将文本文件作为SQL表中的列导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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