开门见山,直接以例子介绍:
CREATE TABLE [dbo].[course](
[id] [int] NULL,
[name] [nvarchar](50) NULL,
[CourseType] [nvarchar](50) NULL,
[Course] [float] NULL
)
[id] [int] NULL,
[name] [nvarchar](50) NULL,
[CourseType] [nvarchar](50) NULL,
[Course] [float] NULL
)
导入数据:
将下面的数据存储为文本文件或SQL文件
2,李刚,语文,89;3,李刚,数学,79;3,李刚,英语,69;4,李刚,化学,89
导入语句:
BULK INSERT dbo.course
FROM 'd:\course.txt '
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = ';'
)
FROM 'd:\course.txt '
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = ';'
)
有关 BULK INSERT 示例,请参阅: