目录
一、测试表及数据
1、测试表名(Date_TEMP)
CREATE TABLE [dbo].[Date_TEMP](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Num] [nvarchar](50) NULL,
[QrCode] [nvarchar](50) NULL,
[DataCode] [nvarchar](50) NULL,
[SearchCount] [int] NULL,
[LastSearchTime] [datetime] NULL,
[BatchNo] [int] NULL,
CONSTRAINT [PK_Date_TEMP] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
2、测试数据文件(1.txt)
aaaaaa,11111,111aaa
bbbbbb,22222,222bbb
cccccc,33333,333ccc
dddddd,44444,444ddd
eeeeee,55555,555eee
二、定义TXT数据文件格式化和查询输出TXT数据文件内容
1、定义需导入的数据文件格式化(dataXml.xml)
<?xml version="1.0"?>
<BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format"