将选定的列从 CSV 文件导入到 SQL Server 表

发布于 2024-09-13 10:27:39 字数 136 浏览 3 评论 0原文

我正在尝试将数据从 CSV 文件导入到 SQL Server 2008 表。数据上传正在工作,但我只想导入选定的列,而不是全部,并将它们添加到相同编号的新表中。使用向导,但它没有发生,向导正在选择所有列。

那么是否可以使用向导仅导入选定的列。

I am trying to import data from a CSV file to a SQL Server 2008 table. Data upload is working, but I want to import only selected columns, not all, and add them to a a new table, of same no. of columns, using the wizard, but its not happening, the wizard is selecting all the columns.

So is it possible using wizard that I only import selected columns.

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

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

发布评论

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

评论(3

探春 2024-09-20 10:27:39

如果您使用导入/导出向导,当您进入“选择源表和视图”时,单击屏幕左下角的“编辑映射”按钮。这将打开列映射屏幕;在目标列上选择“忽略”以删除您不想导入的列。

If you are using the Import / Export wizard, when you get to Select Source Tables and Views click on the button "Edit Mappings" on the bottom left of the screen. That opens column mappings screen; on the destination column select Ignore to remove the column you don't want to import.

寄意 2024-09-20 10:27:39

由于大多数在 2019 年搜索此问题的人不会使用 SQL2008,因此我将为 SQL Server 2016 添加以下内容:

当您选择平面文件数据源时,窗口左侧有一个“高级”选项。单击该按钮。

您将看到一个字段名称列表,其下方有 3 个按钮。其中之一是删除。

突出显示您不想包含的字段,然后单击“删除”按钮。对您不想导入的所有字段执行此操作。

Since most people searching this question in 2019 aren't going to be using SQL2008, I'll add this for SQL Server 2016:

When you choose your Flat File data source, there is an Advanced option to the left of the window. Click that.

You will see a list of field names, and just below that there are 3 buttons. One of them is Delete.

Highlight the field you do not want to include and click the Delete button. Do this for all fields you do not wish to import.

故笙诉离歌 2024-09-20 10:27:39

首先使用与选择数据源文件中声明的相同的数据类型。选择“目标文件”后,转到编辑映射,然后选择“编辑sql”并仅采用选定的列并声明相同的数据类型。编辑映射选择忽略您不需要的列并声明相同的数据类型。

First Use same data type which declare in choose data source file. After choosing "destination file" go to edit mapping, and select "edit sql" and take only selected column and declare the same data type. edit mapping select Ignore which column you don't want and declare same data type.

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