在 SQL Server 2005 中,您不能使用,
between values
:
代替:
INSERT INTO Employees
VALUES(N'593705', N'Frank Somah', N'20061004', 26.15),
(N'720947', N'Paul Handsome', N'20000802', 36.05);
使用SELECT
withUNION ALL
或 multiple INSERT...VALUES...
:
INSERT INTO Employees
SELECT N'593705', N'Frank Somah', N'20061004', 26.15
UNION ALL
SELECT N'720947', N'Paul Handsome', N'20000802', 36.05
INSERT INTO Employees
Values(N'593705', N'Frank Somah', N'20061004', 26.15)
INSERT INTO Employees
Values(N'720947', N'Paul Handsome', N'20000802', 36.05)
GO
INSERT INTO Employees(EmployeeName, EmployeeNumber, DateHired)
VALUES(N'Clarice Simms', N'971403', N'20011112');
GO
因此,您的完整脚本将是:
CREATE TABLE Employees
(
EmployeeNumber nchar(10),
EmployeeName nvarchar(50),
DateHired datetime,
HourlySalary money
);
GO
INSERT INTO Employees
select N'593705', N'Frank Somah', N'20061004', 26.15
union all
select N'720947', N'Paul Handsome', N'20000802', 36.05
GO
INSERT INTO Employees(EmployeeName, EmployeeNumber, DateHired)
VALUES(N'Clarice Simms', N'971403', N'20011112');
GO