基本上我已经在SQL Server中创建了一个表:
CREATE TABLE [Books]
(
[store] int,
[sgxg] int,
[t] varchar(50),
[movie] varchar(50),
[year] int
);
但是当我从我的表books
中选择行时,即使我刷新它也没有任何内容。创建了5列,但没有插入数据?
答案 0 :(得分:0)
您的表格定义为:
CREATE TABLE [Books]
(
[store] int,
[sgxg] int,
[t] varchar(50),
[movie] varchar(50),
[year] int
);
您的程序几乎正确无误。试试这个:
CREATE PROC [InsertBooks]
AS
BEGIN
BULK INSERT [Books]
FROM 'C:\Users\dachen\workspace\612Lab3(XMLFinalVersion)\books.txt'
WITH (
FIRSTROW=2,
FIELDTERMINATOR=',',
ROWTERMINATOR='\n'
)
END;
执行以下程序:
EXECUTE [InsertBooks];
查看插入的数据:
SELECT * FROM [Books]