很多时候,需要批量的导数据,可能大家想到的第一反应就是右键数据库->任务->导入导出数据。但是其实微软自身提供的大容量导入导出工具,有bcp, bulkinsert 之类的也是很好用。今天整理一下bcp 的常规用法

首先bcp 的介绍页,请:https://msdn.microsoft.com/zh-cn/library/aa337544(v=sql.120).aspx

首先我们先搞个测试表来做测试

CREATE TABLE [dbo].[t3](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [name] [nvarchar](50) NULL,
    [Chinese] [int] NULL,
    [Math] [int] NULL
) ON [PRIMARY]
go


CREATE TABLE [dbo].[t4](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [name] [nvarchar](50) NULL,
    [Chinese] [int] NULL,
    [Math] [int] NULL
) ON [PRIMARY]
go

USE [Test]
GO

INSERT [dbo].[t3] ( [name], [Chinese], [Math]) VALUES ( N'张三', 90, 80)
GO
INSERT [dbo].[t3] ( [name], [Chinese], [Math]) VALUES ( N'李四', 75, 90)
GO
INSERT [dbo].[t3] ( [name], [Chinese], [Math]) VALUES ( N'王五', 68, 100)
GO
INSERT [dbo].[t3] ( [name], [Chinese], [Math]) VALUES (N'赵六', 100, NULL)
GO
INSERT [dbo].[t3] ( [name], [Chinese], [Math]) VALUES ( N'うずまき ナルト ', 59, 80)
GO
创建测试表和数据

相关文章:

  • 2022-12-23
  • 2021-12-11
  • 2022-02-27
  • 2022-03-04
  • 2022-12-23
  • 2021-11-30
  • 2021-09-17
  • 2021-09-05
猜你喜欢
  • 2022-03-04
  • 2021-10-18
  • 2021-07-19
  • 2021-12-11
  • 2021-04-05
  • 2022-02-18
  • 2022-01-09
相关资源
相似解决方案