将许多平面文件加载到 SQL Server 2005 中

发布于 2024-10-05 19:07:44 字数 278 浏览 0 评论 0原文

我有一个非常烦人的任务。我必须将超过 100 个 CSV 文件从文件夹加载到 SQL Server 数据库。这些文件的第一行有列名称。所有列的数据类型都可以是 varchar。数据库中的表名可以只是 CSV 的文件名。我目前正在做的是使用 SSMS 中的导入/导出向导,从下拉框中选择平面文件,选择文件,下一步 -> 下一步 -> 下一步并完成!有什么想法如何在集成服务中或使用任何其他实用方法自动执行此类任务?

注意:文件位于我的本地 PC 上,数据库服务器位于其他位置,因此我无法使用 BULK INSERT。

I have a very annoying task. I have to load >100 CSV-files from a folder to SQL Server database. The files have column names in first row. Data type can be varchar for all columns. The table names in database can just be filename of the CSVs. What I am currently doing is that I use Import/Export Wizard from SSMS, I choose flatfile from dropdown box, choose the file, next->next->next and finish! Any ideas how can I automate such a task in Integration services or with any other practical method?

Note: Files are on my local PC, DB-server is somewhere else, so I cannot use BULK INSERT.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

帝王念 2024-10-12 19:07:44

您可以使用 SSIS - Foeach 循环容器来提取文件名 - 通过排列为特定格式。使用变量以文件名动态填充变量。然后在 dataflowtask 中,使用平面文件源作为源 - oledb 目标。

请发布一些示例文件名,以便我可以正确地学习和指导您。

谢谢

阿楚达拉姆

You can use SSIS - Foeach loop container to extract file names - by arranging to particular format.Use a variable to dynamically fill the variable with file name.Then in dataflowtask , use flat file source for source - oledb destination.

Please post some sample file names.so that i can learn and guide you properly.

Thanks

Achudharam

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文